汎用ログ・アダプターは、ユーザー・アダプターによって生成された共通ベース・イベント・オブジェクト をロギング・エージェントに送信するためのアウトプッター・クラスを提供します。ログおよびトレース・アナライザーを使用して、ロギング・エージェントに接続し、アプリケーション・ログをリアルタイムでモニターおよび分析することができます。
前提条件:モニターするには、以下のステップに従って、アダプターを構成してください。
注: 新規アダプター構成ファイルが作成されると、デフォルトで、
CBELogOutputter クラスを使用するように構成されます。この設定を変更していない場合は、
この手順をスキップできます。
アダプター構成ファイル内のアウトプッター・コンポーネントを、共通ベース・イベント・オブジェクト
をロギング・エージェントに書き込む CBELogOutputter クラスを使用するように、更新する必要があります。既存のアウトプッター・コンポーネントを更新するか、または新規アウトプッター・コンポーネントを追加できます。
新規アウトプッター・コンポーネントを追加するには、以下のようにします。
名前: | コンテキストにおけるアウトプッターの名前。 たとえば、Logging Agent Outputter など。 |
説明: | このアウトプッターが何を行うかについての 説明 |
実行可能クラス: | org.eclipse.hyades.logging.adapter.outputters.CBELogOutputter |
ロギング・レベル: | アウトプッター・コンポーネント が使用する内部ロギングのレベル。このレベルは、CommonBaseEvent 重大度値に基づきます。レベル番号が高いほど、メッセージの重大度が高くなります。ロギング・レベルに指定したレベル番号以上の重大度をもつ内部アウトプッター・メッセージのみが、アウトプッター・コンポーネントによってログに記録されます。 71 以上の値は、アウトプッターが内部アウトプッター・メッセージをログに記録しないことを意味します。値 0 は、 アウトプッターがすべての重大度の内部アウトプッター・メッセージをログに記録することを意味します。推奨値は 50 です。この値は、「重大」または「致命的」である内部アウトプッター・ エラー・メッセージのみがログに記録されることを意味します。 |
役割: | アウトプッター |
固有の ID: | ステップ 3 で 「コンテキスト・インスタンス」に定義したアウトプッターを指していなければなりません。 「参照」ボタンを使用して正しい ID を選択します。 |
ログ・パーサーによってログ・ファイルを連続してモニター する場合は、アダプター構成ファイルのコンテキスト・インスタンス・プロパティーを連続稼働用に更新する必要があります。
作成したログ・アダプターは、Windows 環境ではバッチ・ファイルから、
Windows 以外の環境ではシェル・スクリプトから、外部で実行することができます。以下に、ログ・アダプターを実行する Java プロセスを起動する場合に役立つサンプル・ファイルを示します。
注: 汎用ログ・アダプターが作成するロギング・エージェントを接続してモニターするには、
汎用ログ・アダプターを実行するシステム上に Agent Controller をインストールし、汎用ログ・アダプター
の開始前に開始する必要があります。
Windows バッチ・ファイル:
@rem USAGE: runregex @rem PURPOSE: Illustrates the functional capabilities of the Generic Log Adapter (GLA) run-time using an example adapter file and sample log file. @rem INSTRUCTIONS: When executing in a GLA run-time environment, change the value of the %GLA_HOME% environment variable to the absolute path of the unzipped GLA run-time. @rem NOTE: When executing in a plug-in (e.g. Eclipse) run-time environment, create a temporary working directory and change the value of the %GLA_HOME% environment variable to the @rem absolute path of the new temporary working directory. Furthermore, create a %GLA_HOME%¥config directory and copy the contents of the org.eclipse.hyades.logging.adapter.config @rem plug-in to the new %GLA_HOME%¥config directory. Finally, create a %GLA_HOME%¥lib directory and copy the following JAR files to the new %GLA_HOME%¥lib directory: @rem Plug-in | JAR @rem --------------------------------------------------- @rem org.eclipse.hyades.logging.adapter | hgla.jar @rem org.eclipse.hyades.logging.core | hlcbe101.jar @rem org.eclipse.hyades.logging.core | hlcore.jar @rem org.eclipse.hyades.execution.remote | hexr.jar @rem org.eclipse.emf.ecore | ecore.jar @rem org.eclipse.emf.common | common.jar SET GLA_HOME=d:¥GenericLogAdapter SET MY_DIRECTORY=MyAdapter SET CONFIG_FILE=%GLA_HOME%¥config¥%MY_DIRECTORY%¥myadapter.adapter PUSHD %GLA_HOME%¥config¥%MY_DIRECTORY%¥java -DGLA_HOME="%GLA_HOME%" -classpath "%GLA_HOME%¥lib¥hgla.jar;%GLA_HOME%¥lib¥hexr.jar;%GLA_HOME%¥lib¥hlcbe101.jar;%GLA_HOME%¥lib¥ecore.jar;%GLA_HOME%¥lib¥common.jar;%GLA_HOME%¥lib¥hlcore.jar" org.eclipse.hyades.logging.adapter.Adapter -ac "%CONFIG_FILE%" -cc "%CONFIG_FILE%" POPDWindows 以外のバッチ・ファイル:
#!/bin/sh # USAGE: runregex_example.sh # PURPOSE: Illustrates the functional capabilities of the Generic Log Adapter (GLA) run-time using an example adapter file and sample log file. # INSTRUCTIONS: When executing in a GLA run-time environment, change the value of the $GLA_HOME environment variable to the absolute path of the unzipped GLA run-time. # NOTE: When executing in a plug-in (e.g. Eclipse) run-time environment, create a temporary working directory and change the value of the $GLA_HOME environment variable to the # absolute path of the new temporary working directory. Furthermore, create a $GLA_HOME/config directory and copy the contents of the com.ibm.etools.logging.adapter.config # plug-in to the new $GLA_HOME/config directory. Finally, create a $GLA_HOME/lib directory and copy the following JAR files to the new $GLA_HOME/lib directory: # Plug-in | JAR # --------------------------------------------------- # org.eclipse.hyades.logging.adapter | hgla.jar # org.eclipse.hyades.logging.core | hlcbe101.jar # org.eclipse.hyades.logging.core | hlcore.jar # org.eclipse.hyades.execution.remote | hexr.jar # org.eclipse.emf.ecore | ecore.jar # org.eclipse.emf.common | common.jar GLA_HOME=/home/eclipse/GenericLogAdapter export GLA_HOME YOUR_DIRECTORY=MY_DIRECTORY export MY_DIRECTORY CONFIG_FILE="$GLA_HOME/config/$MY_DIRECTORY/myadapter.adapter" export CONFIG_FILE CUR_DIR=`pwd` export CUR_DIR cd "$GLA_HOME/config/$MY_DIRECTORY java -DGLA_HOME="$GLA_HOME" -classpath "$GLA_HOME/lib/hgla.jar:$GLA_HOME/lib/hexr.jar:$GLA_HOME/lib/hlcbe101.jar:$GLA_HOME/lib/ecore.jar:$GLA_HOME/lib/common.jar:$GLA_HOME/lib/hlcore.jar"org.eclipse.hyades.logging.adapter.Adapter -ac "$CONFIG_FILE" -cc "$CONFIG_FILE" cd "$CUR_DIR"必要に応じて、アダプターを実行する Java プロセスを起動するファイルを構成します。
これで、ライブ・アプリケーション・ログをモニターできるようになりました。
関連概念
Hyades 汎用ログ・アダプターの概要
共通ベース・イベント・フォーマット仕様
関連タスク
ログ・パーサーの作成
関連参照
アダプター構成ファイルの構造
アダプター構成エディター
正規表現グラマー
(C) Copyright IBM Corporation 2000, 2005. All Rights Reserved.