且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在JBoss6 AS中“激活" SLF4J日志记录

更新时间:2023-02-22 19:13:37

我终于找到了更新问题的答案.

因为它与原始问题有很大不同,所以我打开了一个新项目:

SLF4J logger.debug()无法获取登录到JBoss 6

Given:

JBoss 6 Application Server M3

$ ls -la $JBOSS_HOME/common/lib/slf4j-*
-rwx------+ common/lib/slf4j-api.jar
-rwx------+ common/lib/slf4j-jboss-logmanager.jar

I believe that the above libs provide the bridge between SLF4J and the JBoss Logging system.

My Web application relies on SLF4J for logging. Though, I don't package any slf4j libs with my WAR.

$ jar tvf proj-web/target/proj.war | grep slf4
$

(If I include them, doesn't make any difference)

My jboss-logging.xml has set the level for the CONSOLE handler to DEBUG

$ more server/default/deploy/jboss-logging.xml
...
   <console-handler name="CONSOLE" autoflush="true" target="System.out">
      <error-manager>
         <only-once/>
      </error-manager>
      <level name="DEBUG"/>

Question:

What did I forget to get my logging output into the JBoss logging system? I don't even see a TRACE that he tries to bind the JBoss Logging system to SLF4J.

=====[ UPDATE ]=====

It does actually work!! (without further configuration)

I just changed my code from logger.debug("abc") to logger.info("xyz") and now i do have logging output.

=> So it looks like I'm simply not able to get get log-level filtering right... [to be continued]

I finally found the answer to my updated question.

As it is so different from the original question, I've opened a new item:

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