WebSphere Application Server Network Deployment, Version 6.0.x     Operating Systems: AIX, HP-UX, Linux, Solaris, Windows

Using the Java Logging API to Generate and Log Common Base Events

In the WebSphere Application Server, the Java logging API (java.util.logging) automatically creates Common Base Events for events logged at level WsLevel.DETAIL or above (including WsLevel.DETAIL, Level.CONFIG, Level.INFO, WsLevel.AUDIT, Level.WARNING, Level.SEVERE, and WsLevel.FATAL). These Common Base Events are created using the event factory associated with the Logger to which the message was logged. If no event factory is specified, WebSphere Application Server uses a default event factory which will automatically fill in WebSphere Application Server specific information.

The java.util.logging.Logger class provides a variety of methods with which data can be logged. The WebSphere Application Server uses a special implementation of the Logger class that automatically creates Common Base Events for the following methods:
  • config
  • info
  • warning
  • severe
  • log - all variants except log(LogRecord) when used with WsLevel.DETAIL or more severe levels
  • logp - when used with WsLevel.DETAIL or more severe levels
  • logrb - when used with WsLevel.DETAIL or more severe levels
WebSphere Application Server logger implementation is only used for named loggers (for example, loggers instantiated with calls such as Logger.getLogger("com.xyz.SomeLoggerName")). Loggers instantiated with calls to Logger.getAnonymousLogger() and Logger.getLogger(""), or Logger.global do not use the WebSphere Application Server implementation, and do not automatically create Common Base Events for logging requests made to them. LogRecords logged directly with Logger.log(LogRecord) are not automatically converted by WebSphere Application Server’s Loggers into Common Base Events.

The following diagram illustrates how application code can create log CommonBaseEvents:

The Java logging API processing of named Loggers and message level events proceeds as follows:
  1. Application code invokes named Logger (WsLevel.DETAIL or above) with event specific data.
  2. Logger creates a CommonBaseEvent using createCommonBaseEvent method on EventFactory associated to the Logger (see Configuring Common Base Events for an application).
  3. Logger creates a CommonBaseEvent using EventFactory associated to the Logger
  4. Logger wraps CommonBaseEvent in a CommonBaseEventLogRecord, and adds event specific data.
  5. Logger calls CommonBaseEvent’s complete() method.
  6. CommonBaseEvent invokes ContentHandler’s completeEvent() method.
  7. ContentHandler adds XML template data to CommonBaseEvent (including for example, the component name). Note that not all ContentHandlers support templates.
  8. ContentHandler adds runtime data to CommonBaseEvent (including for example, the current thread name).
  9. Logger passes CommonBaseEventLogRecord to Handlers.
  10. Handlers format data and write to Output Device.
Reference topic    

Terms of Use | Feedback

Last updated: Mar 17, 2005 4:28:29 AM CST
http://publib.boulder.ibm.com/infocenter/ws60help/index.jsp?topic=/com.ibm.websphere.nd.doc/info/ae/ae/rtrb_cbejavaapi.html

© Copyright IBM Corporation 2004, 2005. All Rights Reserved.
This information center is powered by Eclipse technology. (http://www.eclipse.org)