【发布时间】:2012-03-19 11:05:06
【问题描述】:
我在 JBoss AS7 和日志记录方面有点挣扎。尽管我的问题是一个非常普遍的问题,但我在网上找不到任何相关内容。
默认日志目前如下所示:
11:57:29,950 INFO [stdout] (http--0.0.0.0-8081-78) 248408930 [http--0.0.0.0-8081-78] INFO org.apache.http.impl.client.DefaultHttpClient - I/O exception (java.net.SocketException) caught when processing request: Connection reset
11:57:29,950 INFO [stdout] (http--0.0.0.0-8081-78) 248408930 [http--0.0.0.0-8081-78] INFO org.apache.http.impl.client.DefaultHttpClient - Retrying request
注意 [stdout],那些被某个库使用并被 JBoss 拾取并写入日志文件的日志库写入 stout 的行。这就是我要解决的问题。
我想一定有办法让适配器告诉 log4j(或任何其他日志框架)记录到 jboss 日志子系统?
我的第一个想法是从我的项目的类路径中删除所有 log4j 配置。我在我使用的一个库中找到了一个,它确实记录到标准输出。但这并不能解决任何问题。
11:21:01,648 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) log4j:WARN No appenders could be found for logger (org.springframework.web.context.support.StandardServletEnvironment).
11:21:01,648 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) log4j:WARN Please initialize the log4j system properly.
11:21:01,648 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
未配置附加程序时的常见错误消息。至少我可以确定类路径中不再有任何配置。
JBoss AS 文档甚至没有提到这种情况,当我无法获得正确的日志记录时,我应该如何使用 3rd 方库?
我真的希望有人可以帮助我,感谢任何提示!
马拉克斯
【问题讨论】:
标签: logging jboss log4j jboss7.x