Java アダプターでのロギング

improve this page | report issue

概説

このチュートリアルでは、Java アダプターにロギング機能を追加するために必要なコード・スニペットを提供します。

ロギング例

java ロギング・パッケージをインポートします。

import java.util.logging.Logger;

ロガーを定義します。

static Logger logger = Logger.getLogger(JavaLoggerTestResource.class.getName());

ここで、メソッド内にロギングを組み込みます。

logger.warning("Logging warning message...");

このメッセージは、アプリケーション・サーバーの trace.log ファイルに出力されます。 サーバー管理者が MobileFirst Server から MobileFirst Analytics Server にログを転送している場合は、logger メッセージは MobileFirst Analytics Console の「インフラストラクチャー」→「サーバー・ログの検索」ビューにも表示されます。

ログ・ファイルへのアクセス

Analytics サーバーへのログの転送

ログを Analytics コンソールに転送することもできます。

  1. MobileFirst Operations Console のサイドバー・ナビゲーションから、「設定」オプションを選択します。
  2. 「ランタイム・プロパティー」タブの「編集」ボタンをクリックします。
  3. 「Analytics」 → 「追加パッケージ」セクションで、Java アダプターのクラス名 (com.sample.JavaLoggerTestResource など) を指定して、ログを MobileFirst Server に転送します。

コンソールからのログ・フィルタリング

Inclusive terminology note: The Mobile First Platform team is making changes to support the IBM® initiative to replace racially biased and other discriminatory language in our code and content with more inclusive language. While IBM values the use of inclusive language, terms that are outside of IBM's direct influence are sometimes required for the sake of maintaining user understanding. As other industry leaders join IBM in embracing the use of inclusive language, IBM will continue to update the documentation to reflect those changes.
Last modified on March 15, 2018