14.3.9. Configure a Custom Log Formatter in the CLI


In addition to the log formatter syntax specified in Section 14.1.15, “Log Formatter Syntax”, a custom log formatter can be created for use with any log handler. This example procedure will demonstrate this by creating a XML formatter for a console log handler.


  • Access to the Management CLI for the JBoss EAP 6 server.
  • A previously configured log handler. This example procedure uses a console log handler.

Procedure 14.4. Configure a Custom XML Formatter for a Log Handler

  1. Create custom formatter.
    In this example, the following command creates a custom formatter named XML_FORMATTER that uses the java.util.logging.XMLFormatter class.
    [standalone@localhost:9999 /] /subsystem=logging/custom-formatter=XML_FORMATTER:add(class=java.util.logging.XMLFormatter, module=org.jboss.logmanager)
  2. Register a custom formatter for the log handler you want to use it with.
    In this example, the formatter from the previous step is added to a console log handler.
    [standalone@localhost:9999 /] /subsystem=logging/console-handler=HANDLER:write-attribute(name=named-formatter, value=XML_FORMATTER)
  3. Restart the JBoss EAP 6 server for the change to take effect.
    [standalone@localhost:9999 /] shutdown --restart=true

The custom XML formatter is added to the console log handler. Output to the console log will be formatted in XML, for example:

  <message>JBAS015951: Admin console listening on http://%s:%d</message>