nimbus (1.2.4) | 2018-01-25 20:02 |
nimbus-sample (1.2.4) | 2018-01-26 17:06 |
jp.ossc.nimbus.service.log.DefaultCommonsLogFactoryServiceは、LogServiceの拡張で、The Apache Jakarta ProjectのCommons Loggingのインタフェースで出力したログを、Nimbusのログとして出力するLogger実装サービスです。
このサービスは、複合的なサービスで、以下のサービスを下位サービスとして使用します。
下位サービスインタフェース | 用途 |
jp.ossc.nimbus.service.message.MessageRecordFactory | メッセージIDからログメッセージを取得する。MessageRecordの実装クラスとして、ログメッセージ専用のLogMessageRecordImplを使用します。 |
jp.ossc.nimbus.service.queue.Queue | フォーマット及び出力を非同期で行う |
jp.ossc.nimbus.service.writer.WritableRecordFactory | メッセージをフォーマットする。実装サービスとして、ログ出力専用のLogWritableRecordFactoryServiceを使用します。 |
jp.ossc.nimbus.service.writer.MessageWriter | メッセージを出力する |
jp.ossc.nimbus.service.log.LogCategory | メッセージIDに紐付けられたカテゴリに出力する |
以下に簡単なサービス定義を示します。
- <?xml version="1.0" encoding="Shift_JIS"?>
- <!DOCTYPE server PUBLIC
- "-//Nimbus//DTD Nimbus 1.0//JA"
- "http://nimbus.sourceforge.jp/dtd/nimbus-service_1_0.dtd">
- <server>
- <manager>
- <!-- ログ出力を行うLoggerサービス -->
- <service name="Logger"
- code="jp.ossc.nimbus.service.log.DefaultCommonsLogFactoryService">
- <!-- Commons Logging のTRACEレベルのログ出力を設定する -->
- <attribute name="CommonsTraceEnabled">true</attribute>
- <!-- Commons Logging のDEBUGレベルのログ出力を設定する -->
- <attribute name="CommonsDebugEnabled">true</attribute>
- <!-- Commons Logging のINFOレベルのログ出力を設定する -->
- <attribute name="CommonsInfoEnabled">true</attribute>
- <!-- Commons Logging のWARNレベルのログ出力を設定する -->
- <attribute name="CommonsWarnEnabled">true</attribute>
- <!-- Commons Logging のERRORレベルのログ出力を設定する -->
- <attribute name="CommonsErrorEnabled">true</attribute>
- <!-- Commons Logging のFATALレベルのログ出力を設定する -->
- <attribute name="CommonsFatalEnabled">true</attribute>
- </service>
- </manager>
- </server>
Commons Loggingにプラグインさせるために、クラスパス上に以下のプロパティファイルを配置する。
commons-logging.properties
org.apache.commons.logging.LogFactory=jp.ossc.nimbus.service.log.NimbusLogFactory jp.ossc.nimbus.service.log.NimbusLogFactory.CommonsLogFactoryName=Nimbus#Logger