14.3.9. CLI でのカスタムログフォーマッターの設定
「ログフォーマッター構文」 のログフォーマッター構文の他に、ログハンドラーと使用するカスタムのログフォーマッターを作成できます。この手順例では、コンソールログハンドラーに対して XML フォーマッターを作成して説明します。
前提条件
- JBoss EAP 6 サーバーの管理 CLI へのアクセス。
- 以前設定されたログハンドラー。この手順例では、コンソールログハンドラーを使用します。
手順14.4 ログハンドラーのカスタム XML フォーマッターの設定
- カスタムフォーマッターを作成します。この例では、次のコマンドは
java.util.logging.XMLFormatterクラスを使用するXML_FORMATTERという名前のカスタムフォーマッターを作成します。[standalone@localhost:9999 /]
/subsystem=logging/custom-formatter=XML_FORMATTER:add(class=java.util.logging.XMLFormatter, module=org.jboss.logmanager) - 使用したいログハンドラーのカスタムフォーマッターを登録します。この例では、前の手順のフォーマッターがコンソールログハンドラーに追加されます。
[standalone@localhost:9999 /]
/subsystem=logging/console-handler=HANDLER:write-attribute(name=named-formatter, value=XML_FORMATTER) - JBoss EAP 6 サーバーを再起動し、変更を反映します。
[standalone@localhost:9999 /]
shutdown --restart=true
カスタム XML フォーマッターがコンソールログハンドラーに追加されます。コンソールログへの出力は XML でフォーマットされます。
<record> <date>2014-03-11T13:02:53</date> <millis>1394539373833</millis> <sequence>116</sequence> <logger>org.jboss.as</logger> <level>INFO</level> <class>org.jboss.as.server.BootstrapListener</class> <method>logAdminConsole</method> <thread>282</thread> <message>JBAS015951: Admin console listening on http://%s:%d</message> <param>127.0.0.1</param> <param>9990</param> </record>

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.