开发者

WAS Logging - Java Util Logging and Log4j

开发者 https://www.devze.com 2023-02-07 00:54 出处:网络
I am seeking confirmations on followings: Using Websphere Application Server Admin Console, we can specify some logging configurations and that shows classes of your application also (as shown below

I am seeking confirmations on followings:

  1. Using Websphere Application Server Admin Console, we can specify some logging configurations and that shows classes of your application also (as shown below). If I enable logging in WAS console, will it work only if My Application (and other classes which are mentioned in there) have JUL implemented into it?

    WAS Logging - Java Util Logging and Log4j

  2. By default the logging using WAS console is done in the trace file (${SERVER_LOG_ROOT}/trace.log). Can this be made to console also? (I think yes, just be changing it to ${S开发者_运维技巧ERVER_LOG_ROOT}/SystemOut.log)

  3. Is there any way to configure Log4j properties also from WAS console? (I think no, thus we need to use other ways to make it Log4j configurable).

PS: I understand that JUL provides abstraction as well as its own implementation. The above questions are asked keeping JUL implementation in mind :)


Hello We just when through the same exercise: JUL vs Log4j when using WAS. We decided to go for Log4j.

1) Yes if your App use JUL, you should be able to change the Level from that console.

2) I am not sure.

3) No you cannot change Log4j from WAS Console. In our case we created a simple MBean so we could control the Lo4j log Level of each WebApp (via wsadmin). There is also a nice and simple JSP from BEA that you can include in you WebApp to have a UI to see each category.

If you decide to use JUL (over log4j), make sure to understand the following implication:

  • JUL doest not have many out-of the box Handlers.

  • JUL is at the JVM Level, All you App will share it. If you develop custom JUL Hanlder, all WebApp will share the same Instance.

  • Because JUL Handler are common, it is hard to split Each App in a separate logfile(one per WebApp).

  • When using third party Lib (Spring, Ibatis etc) and if you use JUL, when you will change the Log Level to DEBUG on Spring, it will be changed for ALL you WebApp. If you need more fine grain (changing level on Spring on a specific WebApp) then it is better to embed Log4j in each WebApp.

Hope this will help you

0

精彩评论

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

关注公众号