Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SLF4J logger.debug() does not get logged in JBoss 6

Context: JBoss Application Server 6

I am relying on slf4j-jboss-logmanager.jar to bind slf4j to the JBoss log manager.

All logger.info() output is correctly logged.

However, logger.debug() output never appears in the log stream.

Even though jboss-logging.xml has set the level to DEBUG for the CONSOLE logger...

   <console-handler name="CONSOLE" autoflush="true" target="System.out">
      ...
      <level name="DEBUG"/>
      ...
   </console-handler>

Does anybody see why my debug details never reach the log stream?

like image 786
Jan Avatar asked Aug 05 '10 21:08

Jan


People also ask

What logging framework does SLF4J use?

SLF4J supports popular logging frameworks, namely log4j, java. util. logging, Simple logging and NOP. The logback project supports SLF4J natively.

Does JBoss logging use log4j?

JBoss AS uses log4j as logging framework. This tutorial will show how to configure log4j service in your jBoss application server and also how to create a custom configuration which can be deployed along with your application. Log4j is a flexible open source project from Apache.

What are the logging services provided by the JBoss server?

By default, JBoss produces output to both the console and a log file ( log/server. log ). There are six basic log levels in log4j: TRACE , DEBUG , INFO , WARN , ERROR and FATAL .


1 Answers

As from JBoss 6, the log manager and jboss-logging.xml are proprietary.

The key is in the root-logger definition at the end of the config file:

The default defintion caps all output to whatever hander at INFO level:

   <root-logger>
      <level name="${jboss.server.log.threshold:INFO}"/>
      <handlers>
         <handler-ref name="CONSOLE"/>
         <handler-ref name="ERROR"/>
         <handler-ref name="FILE"/>
      </handlers>
   </root-logger>

Changing this to

   <root-logger>
      <level name="${jboss.server.log.threshold:DEBUG}"/>
      <handlers>

opens the gate for all possible DEBUG information.

Probably too much DEBUG information. Therefore, I had to add some additional filters:

   <logger category="org.jboss">
      <level name="INFO"/>
   </logger>

   <logger category="org.hibernate">
      <level name="INFO"/>
   </logger>

   <logger category="javax">
      <level name="INFO"/>
   </logger>

   <logger category="idealconnector">
      <level name="INFO"/>
   </logger>

   <logger category="httpclient">
      <level name="INFO"/>
   </logger>

   <logger category="my.package">
      <level name="DEBUG"/>
   </logger>
like image 146
Jan Avatar answered Oct 16 '22 23:10

Jan