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 という名前のログ ファイルが生成されます。[#] は、ファイルのローテーション番号を指定します。各ファイルは、ログイン ユーザーの HOME ディレクトリに配置され、各ファイルがいっぱいになると別のファイルに出力されます。
前述のサンプルの logging.properties 項目を使用すると、 ログ レコードが該当するファイルの最後に付加され、 それぞれの項目が単純なフォーマットで保管されるように指定されます。ファイルへの変更が認識されるようにするには、 アプリケーションを停止してから再始動します。
ログ出力ファイルがいっぱいになると、 新規ファイルが作成され、前のファイルはファイルのローテーションが行われた日付とタイム スタンプを含む名前に変更されます。 各ファイルは 20 MB のデータを保持し、既存の項目に新規項目が追加されます。 これは、アプリケーションの再始動の間も行われます。ログ ファイルの数が 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