简体   繁体   English

Jboss日志包装我的log4j消息

[英]Jboss logging wrapping my log4j messages

I've got a bizarre problem with Log4J under JBoss 7.1.0CR1b (we're just porting to JBoss now, no idea if this happens in older versions). 我在JBoss 7.1.0CR1b下遇到了Log4J的奇怪问题(我们现在只是移植到JBoss,不知道是否在旧版本中发生这种情况)。 The log lines from my EAR are all being wrapped in an INFO level. 我的EAR中的日志行都包含在INFO级别中。 So, for example, my log line looks like this: 因此,例如,我的日志行如下所示:

13:09:14,684 INFO  ERROR  CRK TEST! 

The actual log line is using a log4j Logger.error( "CRK TEST!" ). 实际的日志行使用的是log4j Logger.error(“CRK TEST!”)。 Where the heck is the extra "INFO" coming from? 哪里有额外的“INFO”来自? My guess is the logger message is being wrapped by JBoss's logger somehow since this doesn't happen with pure JBoss container messages, such as: 我的猜测是记录器消息被JBoss的记录器以某种方式包装,因为纯JBoss容器消息不会发生这种情况,例如:

13:08:07,177 INFO  [org.jboss.msc] JBoss MSC version 1.0.1.GA

I've fiddled with various log4j settings and trying to walk through the debugger, but coming up blank on why this is happening. 我已经摆弄了各种log4j设置并尝试遍历调试器,但是为什么会发生这种情况,我只是空白。 Any ideas? 有任何想法吗?

I think log4j is writing to stdout which JBoss STDIO takes and outputs as INFO messages to the JBoss Log Manager. 我认为log4j正在写入stdout,JBoss STDIO将其作为INFO消息输出到JBoss Log Manager。

There is a plan to have per deployment logging which could fix this issue, unless your appender is always writing to stdout. 除非您的appender始终写入stdout,否则计划每个部署日志记录可以解决此问题。

So your best solution would be to look at the appender you're using and see where it's writing. 所以你最好的解决方案是查看你正在使用的appender,看看它在哪里写。 If it's writing to stdout it will always appear like that. 如果它正在写入stdout,它总是会出现。

I would guess that your logger is somehow connected to System.out and/or System.err and that someone (perhaps JBoss, perhaps some other EAR/WAR/...) installs a custom OutputStream which wraps everything printed to it into another logger message. 我猜你的记录器以某种方式连接到System.out和/或System.err ,并且某人(可能是JBoss,可能是其他一些EAR / WAR / ...)安装了一个自定义的OutputStream ,它将打印到它的所有内容包装到另一个记录器中信息。 Perhaps the missing '[...]' part indicates, that the root logger has been used. 也许缺少的“[...]”部分表明已经使用了根记录器。

You can test this by printing something directly to bot streams and by fetching the root logger and shove some INFO s into it. 您可以通过直接打印到bot流并通过获取根记录器并将一些INFO推入其中来测试这一点。

Another guess is, that your log4j jars somehow conflict with the slf4j stuff propagated by JBoss/Hibernate. 另一个猜测是, 你的 log4j jars在某种程度上与JBoss / Hibernate传播的slf4j冲突相冲突。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM