Make your webapplication log debug messages under jboss

I often catch myself writing info-messages because jboss is configured to info-mode by default. By adding the following few lines you can make your application use debug mode:

<subsystem xmlns="urn:jboss:domain:logging:2.0">
  ...
  <!-- add begin -->
  <console-handler name="DEBUGCONSOLE">
    <level name="DEBUG" />
    <formatter>
      <pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%F:%L)  %s%E%n" />
    </formatter>
  </console-handler>
  <logger category="pm.mbo" use-parent-handlers="false">
    <level name="DEBUG" />
    <handlers>
      <handler name="DEBUGCONSOLE" />
    </handlers>
  </logger>
  <!-- add end -->
  ...
</subsystem>

Of course you have to change the category (your package name) in the logger. The snippet is from Wildfly 8.1. But it is the same approach for JBoss AS 7+.

Leave a Comment