开发者

custom logging info for deployed application on jboss

I have an application deployed to a jboss server which uses many entityManagers because we handle 开发者_StackOverflow社区many customers with one application. So we have one application talking to many DB-s

When I look at the error logs I cann not see which customer happend to find an error and sometimes it is difficult to debug the error because of this.

How is possible to ovverride the writings in the error log and put some custom info for evry log insert?

This should be possible to achive from the scope of the application because there I have all the information which user is logined etc...

We use :

jboss 5.1 seam 2.1 hibernate log4j for logging


JBoss uses a unified classloader by default, to enable application specific logging you'll want to enable classloader isolation with jboss-classloading.xml in the META-INF or WEB-INF folder.

After enabling classloader isolation, you can use log4j.xml to configure how you want the logs to work. See http://wiki.apache.org/logging-log4j/Log4jXmlFormat


I must admit I don't fully understand your question, but maybe MDC in Log4J is what you need? Using some sort of aspect/filter/proxy you can assign key-value pairs to special thread-local MDC object provided by Log4J. Entries from this map can be retrieved and appended to every logging statement automatically.

This mechanism, since it is local to the running thread, is very often used to display current user name/session id in every logging statement occurring in a given thread, which is very handy.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜