ClearQuest CM API 로깅은 애플리케이션을 실행하는 JRE와 연관된 logging.properties 파일을 사용하여 제어합니다. logging.properties 파일은 JDK의 jre\lib 디렉토리에 있습니다.
기본적으로 로깅은 사용 불가능하게 설정되어 있습니다. INFO 레벨에서 로깅을 사용 가능하게 해야 합니다.
############################################################ # Global properties ############################################################ # # "handlers" specifies a comma separated list of log Handler # classes. These handlers will be installed during VM startup. # Note that these classes must be on the system classpath. # By default we only configure a ConsoleHandler, which will only # show messages at the INFO and above levels. handlers = java.util.logging.ConsoleHandler # To also add the FileHandler, use the following line instead. #handlers= java.util.logging.FileHandler, java.util.logging.ConsoleHandler # Default global logging level. # This specifies which kinds of events are logged across # all loggers. For any given facility this global level # can be overriden by a facility specific level # Note that the ConsoleHandler also has a separate level # setting to limit messages printed to the console. # The next line enables logging (for all logger objects) to occur at the INFO level .level=INFO ############################################################ # Handler specific properties. # Describes specific configuration info for Handlers. ############################################################ # CMLogger - Should always be enabled at the INFO level. # # The following lines designate logging for the CMLogger object to occur at the INFO level, # and that the log output file will be named CMLogger[#].log, located in the logged-in # user's HOME directory; the log output file will rotate through 20 files, each file being # limited to 20000000 bytes. Log entries will be appended to the current log output # file in the rotation and will be written using a simple format. # com.ibm.rational.stp.common.internal.util.CMLogger.level = INFO com.ibm.rational.stp.common.internal.util.LogHandler.pattern = %h/CMLogger%g.log com.ibm.rational.stp.common.internal.util.LogHandler.limit = 20000000 com.ibm.rational.stp.common.internal.util.LogHandler.count = 20 com.ibm.rational.stp.common.internal.util.LogHandler.append = true com.ibm.rational.stp.common.internal.util.LogHandler.formatter = java.util.logging.SimpleFormatter # CMTracer - Enable (uncomment) the entries below for temporary use only, as tracing # can be resource intensive. # # The following lines designate tracing for the CMTracer object to occur at the FINER level, # and that the trace output file will be named CMTracer[#].log, located in the logged-in # user's HOME directory; the trace output file will rotate through 20 files, each file being # limited to 20000000 bytes. Trace entries will be appended to the current trace output # file in the rotation and will be written using a simple format. # #com.ibm.rational.stp.common.internal.util.CMTracer.level = FINER #com.ibm.rational.stp.common.internal.util.TraceHandler.pattern = %h/CMTracer%g.log #com.ibm.rational.stp.common.internal.util.TraceHandler.limit = 20000000 #com.ibm.rational.stp.common.internal.util.TraceHandler.count = 20 #com.ibm.rational.stp.common.internal.util.TraceHandler.append = true #com.ibm.rational.stp.common.internal.util.TraceHandler.formatter = java.util.logging.SimpleFormatter
이와 같이 설정하면 CMLogger[#].log라는 로그 파일이 생성됩니다. 여기서 [#]은 파일 교대 번호를 지정합니다. 각 파일은 로그인된 사용자의 홈 디렉토리에 있으며 각 파일이 가득 차게 되면 출력이 파일에서 파일로 롤링됩니다.
이전 예제의 logging.properties 항목을 사용하면 로그 레코드가 적용 가능한 파일의 끝에 추가되고 각 항목이 단순 형식으로 저장되도록 지정됩니다. 파일 변경사항이 인식되도록 하려면 애플리케이션을 중지한 후 다시 시작해야 합니다.
로그 출력 파일이 가득 차면 새 파일이 작성되고 파일 교대 발생 시의 날짜 및 시간소인을 포함하도록 이전 파일의 이름이 변경됩니다. 애플리케이션을 다시 시작하는 경우에도 각 파일은 20MB의 데이터를 보유하며 새 항목이 기존 항목에 추가됩니다. 로그 파일 수가 20개가 되면 새 파일로 교대되어 가장 오래된 파일이 삭제됩니다.
Java 로깅을 구성하는 방법에 대한 자세한 정보는 java.util.logging.Logger 및 java.util.logging.FileHandler용 JDK와 연관된 Javadoc 문서를 참조하십시오.
사용자 정의 로그 특성 파일을 작성할 때 -D 인수를 사용하여 파일의 위치를 지정해야 합니다. 예를 들어, 다음과 같습니다.
java -Djava.util.logging.config.file=C:\myLogPropsFile.properties your_client_java_program_that_uses_CM-API