デフォルトの Common Base Event コンテンツ・ハンドラーは、Common Base Event に WebSphere Application Server ランタイム情報を取り込みます。 このコンテンツ・ハンドラーは、 Common Base Event テンプレートを使用して、Common Base Event にデータを取り込むことも できます。
// Get a named logger Logger logger = Logger.getLogger("com.ibm.someLogger"); // Log to the logger -- implicitly the default content handler // will be associated with the CommonBaseEvent contained in the // CommonBaseEventLogRecord. logger.warning("MSG_KEY_001");上記の例で Common Base Event テンプレートを指定するには、com.ibm.someLogger のイベント・ファクトリー・エントリーを持つ Logger.properties ファイルを指定する必要があります。 クラスパスで有効なテンプレートが検出された場合、ロガーのイベント・ファクトリーは、Common Base Event にデータを取り込む際に WebSphere Application Server のランタイム情報に加えて指定されたテンプレートのコンテンツを使用します。 テンプレートがクラスパスで検出されないか無効である場合、ロガーのイベント・ファクトリーは、Common Base Event にデータを取り込む際に、WebSphere Application Server ランタイム情報のみを使用します。
// Request the event factory from the global event factory home EventFactory eventFactory = EventFactoryContext.getInstance().getEventFactoryHome().getEventFactory(templateName); // Create a Common Base Event CommonBaseEvent commonBaseEvent = eventFactory.createCommonBaseEvent(); // Complete the Common Base Event using content from the template (if specified above) // and the server runtime information. eventFactory.getContentHandler().completeEvent(commonBaseEvent);上記の例では、templateName によって参照されるテンプレートがクラスパスで検出され、そのテンプレートが有効な場合、イベント・ファクトリー・ホームは、Common Base Event にデータを取り込む際にテンプレートのコンテンツと WebSphere Application Server ランタイム情報を組み合わせるコンテンツ・ハンドラーを使用するイベント・ファクトリーを戻します。 テンプレートがクラスパスで検出されないか無効である場合、イベント・ファクトリー・ホームは、Common Base Event にデータを取り込む際に、WebSphere Application Server ランタイム情報のみを利用するコンテンツ・ハンドラーを使用するイベント・ファクトリーを戻します。
デフォルトのコンテンツ・ハンドラーは、サーバー環境内の Common Base Event に以下のランタイム情報を取り込みます。
この値は、completeEvent メソッドが呼び出される前に、 CommonBaseEvent.globalInstanceId 値が NULL の場合のみ設定します。
この値は、completeEvent メソッドが呼び出される前に、 CommonBaseEvent.msg メッセージが NULL の場合のみ設定します。
この値は、completeEvent メソッドが呼び出される前に、CommonBaseEvent.severity 値が NULL の場合のみ設定します。
この値は、completeEvent メソッドが呼び出される前に、 CommonBaseEvent.ComponentIdentification.component が NULL の場合のみ設定します。
この値は、completeEvent メソッドが呼び出される前に、 CommonBaseEvent.ComponentIdentification.componentIdType 値が NULL の場合のみ設定します。
この値は、completeEvent メソッドが呼び出される前に、 CommonBaseEvent.ComponentIdentification.executionEnvironment 値が NULL の場合のみ設定します。
この値は、completeEvent メソッドが呼び出される前に、CommonBaseEvent.ComponentIdentification.instanceId 値が NULL の場合のみ設定します。 この値はクライアント・アプリケーションでは無視されるため、サーバー環境のみで設定してください。
この値は、completeEvent メソッドが呼び出される前に、 CommonBaseEvent.ComponentIdentification.location と CommonBaseEvent.ComponentIdentification.locationType の両方の値が NULL の場合のみ設定します。
この値は、completeEvent メソッドが呼び出される前に、 CommonBaseEvent.ComponentIdentification.location と CommonBaseEvent.ComponentIdentification.locationType の両方の値が NULL の場合のみ設定します。
この値は、completeEvent メソッドが呼び出される前に、 CommonBaseEvent.ComponentIdentification.processId 値が NULL の場合のみ設定します。
この値は、completeEvent メソッドが呼び出される前、および sourceClassName 名と sourceMethodName 名の両方が設定される前に、CommonBaseEvent.ComponentIdentification.subComponent 値が NULL の場合のみ設定します。
この値は、completeEvent メソッドが呼び出される前に、 CommonBaseEvent.ComponentIdentification.threadId 値が NULL の場合のみ設定します。
この値は、completeEvent メソッドが呼び出される前に、CommonBaseEvent.ComponentIdentification.componentType 値が NULL の場合のみ設定します。
この値は、completeEvent メソッドが呼び出される前に、 CommonBaseEvent.msg 値が NULL の場合のみ設定します。
この値は、completeEvent メソッドが呼び出される前に、CommonBaseEvent.Situation 値が NULL の場合のみ設定します。
この値は、completeEvent メソッドが呼び出される前に、CommonBaseEvent.Situation 値が NULL の場合のみ設定します。
この値は、completeEvent メソッドが呼び出される前に、CommonBaseEvent.Situation 値が NULL の場合のみ設定します。
この値は、completeEvent メソッドが呼び出される前に、CommonBaseEvent.Situation 値が NULL の場合のみ設定します。
コンテンツ・ハンドラーで completeEvent メソッドが呼び出されたときに、reporterComponentIdentification ID が存在しない場合、sourceComponentIdentification 値が取り込まれます。 それ以外の場合は、reporterComponentIdentification ID が代わりに取り込まれます。