WebSphere Application Server - Express for i5/OS, Version 6.1   
             オペレーティング・システム: i5/OS

             目次と検索結果のパーソナライズ化

デフォルト・イベント・ファクトリーを使用した Common Base Event コンテンツの生成

デフォルトの Common Base Event コンテンツ・ハンドラーは、Common Base Event に WebSphere Application Server ランタイム情報を取り込みます。 このコンテンツ・ハンドラーは、 Common Base Event テンプレートを使用して、Common Base Event にデータを取り込むことも できます。

デフォルトのコンテンツ・ハンドラーは、以下の例に示すように、サーバーが CommonBaseEventLogRecords を作成する際に使用されます。
// 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 ランタイム情報のみを使用します。
デフォルトのコンテンツ・ハンドラーは、グローバル・イベント・ファクトリー・コンテキストに指定されているイベント・ファクトリー・ホームにも関連付けられています。 これは、WebSphere Application Server で生成されるコンテンツと似たコンテンツを取り込む必要のある Common Base Event を作成する際に便利です。
// 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 に以下のランタイム情報を取り込みます。

CommonBaseEvent.globalInstanceId
値: unique_record_id

この値は、completeEvent メソッドが呼び出される前に、 CommonBaseEvent.globalInstanceId 値が NULL の場合のみ設定します。

CommonBaseEvent.msg
値: MsgDataElement エレメントを基にしたローカライズされたメッセージ。

この値は、completeEvent メソッドが呼び出される前に、 CommonBaseEvent.msg メッセージが NULL の場合のみ設定します。

CommonBaseEvent.severity
値: CommonBaseEventLogRecord レコード上に設定されたレベルの値を基にして設定します (level >= Level.SEVERE の場合 50 に設定、level >= Level.WARNING の場合 30 に設定、デフォルトでは 10 に設定)。

この値は、completeEvent メソッドが呼び出される前に、CommonBaseEvent.severity 値が NULL の場合のみ設定します。

CommonBaseEvent.ComponentIdentification.component
値: CommonBaseEventLogRecord レコード上に設定された LoggerName 値を基にして設定します。

この値は、completeEvent メソッドが呼び出される前に、 CommonBaseEvent.ComponentIdentification.component が NULL の場合のみ設定します。

CommonBaseEvent.ComponentIdentification.componentIdType
値: 「Unknown」

この値は、completeEvent メソッドが呼び出される前に、 CommonBaseEvent.ComponentIdentification.componentIdType 値が NULL の場合のみ設定します。

CommonBaseEvent.ComponentIdentification.executionEnvironment
値: OSname[OSarch]#OSversion

この値は、completeEvent メソッドが呼び出される前に、 CommonBaseEvent.ComponentIdentification.executionEnvironment 値が NULL の場合のみ設定します。

CommonBaseEvent.ComponentIdentification.instanceId
値: cellName¥nodeName¥serverName

この値は、completeEvent メソッドが呼び出される前に、CommonBaseEvent.ComponentIdentification.instanceId 値が NULL の場合のみ設定します。 この値はクライアント・アプリケーションでは無視されるため、サーバー環境のみで設定してください。

CommonBaseEvent.ComponentIdentification.location
値: ホスト名

この値は、completeEvent メソッドが呼び出される前に、 CommonBaseEvent.ComponentIdentification.location と CommonBaseEvent.ComponentIdentification.locationType の両方の値が NULL の場合のみ設定します。

CommonBaseEvent.ComponentIdentification.locationType
値: ホスト名

この値は、completeEvent メソッドが呼び出される前に、 CommonBaseEvent.ComponentIdentification.location と CommonBaseEvent.ComponentIdentification.locationType の両方の値が NULL の場合のみ設定します。

CommonBaseEvent.ComponentIdentification.processId
値: 内部で生成されたプロセス・ナンバー表記。

この値は、completeEvent メソッドが呼び出される前に、 CommonBaseEvent.ComponentIdentification.processId 値が NULL の場合のみ設定します。

CommonBaseEvent.ComponentIdentification.subComponent
値: CommonBaseEventLogRecord レコードの sourceClassName.sourceMethodName 名上に設定された sourceClassName 名および sourceMethodName 名の値に基づいて設定します。

この値は、completeEvent メソッドが呼び出される前、および sourceClassName 名と sourceMethodName 名の両方が設定される前に、CommonBaseEvent.ComponentIdentification.subComponent 値が NULL の場合のみ設定します。

CommonBaseEvent.ComponentIdentification.threadId
値: Java 仮想マシン (JVM) のスレッド名の値に設定します。

この値は、completeEvent メソッドが呼び出される前に、 CommonBaseEvent.ComponentIdentification.threadId 値が NULL の場合のみ設定します。

CommonBaseEvent.ComponentIdentification.componentType
値: http://www.ibm.com/namespaces/autonomic/WebSphereApplicationServer

この値は、completeEvent メソッドが呼び出される前に、CommonBaseEvent.ComponentIdentification.componentType 値が NULL の場合のみ設定します。

CommonBaseEvent.MsgDataElement.msgLocale
値: JVM のデフォルト・ロケールを基にして設定します。

この値は、completeEvent メソッドが呼び出される前に、 CommonBaseEvent.msg 値が NULL の場合のみ設定します。

CommonBaseEvent.Situation.categoryName
値: ReportSituation

この値は、completeEvent メソッドが呼び出される前に、CommonBaseEvent.Situation 値が NULL の場合のみ設定します。

CommonBaseEvent.Situation.situationType.type
値: ReportSituation

この値は、completeEvent メソッドが呼び出される前に、CommonBaseEvent.Situation 値が NULL の場合のみ設定します。

CommonBaseEvent.Situation.situationType.reasoningScope
値: EXTERNAL

この値は、completeEvent メソッドが呼び出される前に、CommonBaseEvent.Situation 値が NULL の場合のみ設定します。

CommonBaseEvent.Situation.situationType.reportCategory
値: LOG

この値は、completeEvent メソッドが呼び出される前に、CommonBaseEvent.Situation 値が NULL の場合のみ設定します。

コンテンツ・ハンドラーで completeEvent メソッドが呼び出されたときに、reporterComponentIdentification ID が存在しない場合、sourceComponentIdentification 値が取り込まれます。 それ以外の場合は、reporterComponentIdentification ID が代わりに取り込まれます。




関連タスク
Common Base Event API および Java ロギング API を使用したロギング
関連情報
Logger.properties ファイル
Common Base Event ファクトリー
参照トピック    

ご利用条件 | フィードバック

最終更新: Jan 21, 2008 7:05:28 PM EST
http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.express.iseries.doc/info/iseriesexp/ae/rtrb_cbegencontent.html