Thursday, December 20, 2007

Java Util Logging in WebSphere Application Server

Use Java Util Logging in WebSphere Application Server


1. Create a Logger
Logger.getLogger("LoggerName");

Once this function is called, the logger is initialized.

2. logger name choosen

Generally, use package to generate the logger.
For large application, it is better to create in group or component.

such as com.package.COMMAND, com.package.USER, com.package.INVENTORY, com.package.ORDERS.
3. Level
For logging, use error or warning level.
For tracing, use fine, finner.

4. Handler
Do not need specify the handler explicitly. Leave WAS server to handle it.

5. Initialization
Here is the key point and the beauty of WAS.
At server startup, use Servlet initialization method to initialize all the loggers.
This will allow you to view all the logger components at WAS admin console.
Therefore, you have the full ability to control to turn on /off on specific tracing component.

6. Turn on/off tracing component
For the large application, you can always turn on/off tracing at run time without restarting the servers.
At WAS admin console, you can view the tracing components.
Use Runtime tab to turn it on/off for quick problem determination.