CM API 로깅 구성

CM(Change Management) API 로깅을 구성할 수 있습니다.
이 태스크 정보

CM API 로깅은 애플리케이션을 실행 중인 JRE와 연관된 logging.properties 파일을 사용하여 제어됩니다. logging.properties 파일은 JDK의 jre\lib 디렉토리에 있습니다. 예를 들어, C:\Program Files\IBM\WebSphere\AST\eclipse\jre\lib, C:\jdk_5.0\jre\lib 또는 C:\Program Files\Java\jre1.5.0_06\lib입니다.

로깅은 기본적으로 사용 불가능하도록 설정되어 있습니다. INFO 레벨에서 로깅을 사용하도록 설정해야 합니다.

다음 logging.properties 샘플 파일은 CM API 기반의 애플리케이션에 대한 로그 설정을 구성하는 방법을 보여줍니다.
############################################################
#      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. 
#
# Applications using CM API do not have to be stopped and restarted; changes to the configured

# logging.properties file are automatically noticed and honored within 10 seconds.
#
# 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.  
#
# Applications using CM API do not have to be stopped and restarted; changes to the configured
# logging.properties file are automatically noticed and honored within 10 seconds.
#
# 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라는 이름의 로그 파일이 생깁니다. 여기서, [#]는 파일 회전 번호를 지정합니다. 각 파일은 로그인한 사용자의 HOME 디렉토리에 있습니다. 각 파일이 가득 차게 되면 출력은 파일에서 파일로 이동합니다.

이전 예제의 logging.properties 항목을 사용하면 로그 레코드가 적용 가능한 파일의 끝에 추가되도록 지정되며 각 항목은 단순 형식으로 저장됩니다. logging.properties 파일에 대한 변경사항은 약 10초 내에 CM API 기반의 애플리케이션에 의해 인식됩니다. 애플리케이션을 중지하고 다시 시작할 필요가 없습니다.

로그 출력 파일이 가득 차면 새 파일이 작성되고 이전 파일은 파일 회전이 발생할 때 날짜와 시간소인을 포함하도록 이름이 바뀝니다. 각 파일은 20MB의 데이터를 보유하고 교차 애플리케이션 다시 시작을 포함하여 새 항목은 기존 항목에 추가됩니다. 로그 파일 계수가 20이 되면 새 파일을 처음부터 작성하므로 이전 파일이 삭제됩니다.

Java 로깅을 구성하는 방법에 대한 자세한 내용은 java.util.logging.Loggerjava.util.logging.FileHandler에 대한 JDK와 연관된 Javadoc 문서를 참조하십시오.

사용자 정의 로그 특성 파일을 작성하는 경우, -D 인수를 사용하여 JVM의 위치를 지정해야 합니다. 예를 들어, 다음과 같습니다.
java -Djava.util.logging.config.file=C:\myLogPropsFile.properties your_client_java_program_that_uses_CM-API

피드백