Configure separate log messages in JBoss

:heavy_exclamation_mark: This post is older than a year. Consider some information might not be accurate anymore. :heavy_exclamation_mark:

To configure JBoss to log certain messages of log category (class) is a simple way. This post illustrates two ways to achieve it.

Adjust configuration file

Editing the configuration file, e.g. standalone.xml for standalone mode, needs the JBoss instance not to be running.

To log messages to another file, go to subsystem logging.

  <subsystem xmlns="urn:jboss:domain:logging:1.2">

Add logger definition and binding within above section

<periodic-rotating-file-handler name="MESSAGE_LOG" autoflush="true">
<pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
    <file relative-to="jboss.server.log.dir" path="message.log"/>
    <suffix value=".yyyy-MM-dd"/>
    <append value="true"/>
<!-- bind log category to above logger -->
<logger category="net.cinhtau.adapter">
    <level name="DEBUG"/>
        <handler name="MESSAGE_LOG"/>

Logger configuration as CLI script

Configure the JBoss from CLI, needs a running JBoss instance.

Add logger via CLI

		formatter="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n",
/subsystem=logging/logger=net.cinhtau.adapter:add(level=DEBUG, use-parent-handlers=false)

Check the folder log for your separate log file. For further details read for instance

Please remember the terms for blog comments.