Logger実装サービス jp.ossc.nimbus.service.log.DefaultCommonsLogFactoryService

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に紐付けられたカテゴリに出力する

以下に簡単なサービス定義を示します。

  1. <?xml version="1.0" encoding="Shift_JIS"?>
  2. <!DOCTYPE server PUBLIC
  3. "-//Nimbus//DTD Nimbus 1.0//JA"
  4. "http://nimbus.sourceforge.jp/dtd/nimbus-service_1_0.dtd">
  5. <server>
  6. <manager>
  7. <!-- ログ出力を行うLoggerサービス -->
  8. <service name="Logger"
  9. code="jp.ossc.nimbus.service.log.DefaultCommonsLogFactoryService">
  10. <!-- Commons Logging のTRACEレベルのログ出力を設定する -->
  11. <attribute name="CommonsTraceEnabled">true</attribute>
  12. <!-- Commons Logging のDEBUGレベルのログ出力を設定する -->
  13. <attribute name="CommonsDebugEnabled">true</attribute>
  14. <!-- Commons Logging のINFOレベルのログ出力を設定する -->
  15. <attribute name="CommonsInfoEnabled">true</attribute>
  16. <!-- Commons Logging のWARNレベルのログ出力を設定する -->
  17. <attribute name="CommonsWarnEnabled">true</attribute>
  18. <!-- Commons Logging のERRORレベルのログ出力を設定する -->
  19. <attribute name="CommonsErrorEnabled">true</attribute>
  20. <!-- Commons Logging のFATALレベルのログ出力を設定する -->
  21. <attribute name="CommonsFatalEnabled">true</attribute>
  22. </service>
  23. </manager>
  24. </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


ログ/Logger