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

编程入门 行业动态 更新时间:2024-10-23 21:40:25
本文介绍了如何在JBoss6 AS中“激活" SLF4J日志记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

给出:

JBoss 6应用服务器M3

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

我相信上述库提供了SLF4J和JBoss日志记录系统之间的桥梁.

我的Web应用程序依靠SLF4J进行日志记录.不过,我没有在WAR中打包任何slf4j库.

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

(如果我包括它们,没有任何区别)

我的jboss-logging.xml已将CONSOLE处理程序的级别设置为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"/>

问题:

我忘记了将日志记录输出到JBoss日志记录系统中的什么?我什至看不到他尝试 绑定 JBoss Logging系统到 SLF4J 的轨迹. >

===== [更新] =====

确实有效 !! (无需进一步配置)

我刚刚将代码从logger.debug("abc")更改为logger.info("xyz"),现在我有了日志输出.

=>因此,看来我根本无法正确获取日志级别的过滤... [待续]

解决方案

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

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

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

更多推荐

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

本文发布于:2023-11-25 04:03:04,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1628245.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何在   日志   quot   SLF4J

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!