开发者

Log4J Event Viewer Problem

I am develloping 2 applications and publishing them on Websphere Aplication Server.

Since I need to write errors that occur on both applications on the event viewer I put the log4j JAR file on the lib folder of Websphere Aplication Server and the file os being loaded successfully.

I have also cre开发者_高级运维ated the log4j.properties file under src root package of both applications with different variable names and source designation ("Application A" and "Application B").

When an execption is caught it is being logged to the Event Viewer for both cases.

The problem is that the source name presented is the same "Application A" even if the error occured on Application B...

Can anyone help?

Thanks


I'm not sure what you mean by "applications with different variable names and source designation" — that you use differently named loggers in both applications and direct output to different appenders?

Still, I see one problem with your configuration: when you put your log4j jar into WAS lib folder, it's loaded with the class loader common for both your applications (a bootstrap class loader or extension class loader, depending where this "lib" directory is) — and that means log4j is loaded only ONCE. Considering how log4j is initialized (with a static code section), it is also initialized ONCE, meaning that at most one log4j.properties is read.

Try removing log4j from the WAS lib directory and deploy it with every application, see where it gets you.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜