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

improve this page | report issue

概説

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

ロギング例

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

MFP.Logger.debug("This is a debug message from a JavaScript adapter");

追加のロギング・レベルは、詳細度の低い方から順に、ERROR、WARN、INFO、LOG、DEBUG です。

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

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

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

  1. MobileFirst Operations Console のサイドバー・ナビゲーションから、「設定」オプションを選択します。
  2. 「ランタイム・プロパティー」タブの「編集」ボタンをクリックします。
  3. 「Analytics」 → 「追加パッケージ」セクションで、MFP.Logger を指定して、JavaScript アダプターのログを 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 July 02, 2019