Network Deployment (Distributed operating systems), v8.0 > Troubleshoot and support > Add logging and tracing to the application > Log Common Base Events in WAS
Log with Common Base Event API and the Java logging API
When events generated by the Java logging API are insufficient, we can create Common Base Events to add data.
WAS automatically populates WAS-specific information into the Common Base Events. In general, it is good practice to create events using the WAS default Common Base Event factory because this approach ensures consistency of Common Base Event content across events. However, you can create and use other Common Base Event factories.
Common Base Events are initiated and logged in the following sequence:
- Application code invokes the createCommonBaseEvent method on the EventFactory class to create a CommonBaseEvent.
- Application code wraps CommonBaseEvent event in a CommonBaseEventLogRecord record, and adds event-specific data.
- Application code calls the CommonBaseEvent event complete method.
- The CommonBaseEvent event invokes the ContentHandler completeEvent method.
- The ContentHandler handler adds XML template data to the CommonBaseEvent event. Not all ContentHandler handlers support templates.
- The ContentHandler handler adds runtime data to the CommonBaseEvent event.
- Application code passes the CommonBaseEventLogRecord record to the logger using the Logger.log method.
- Logger passes CommonBaseEventLogRecord record to Handlers.
- Handlers format data and write to the output device.
Procedure
- We can use the default Common Base Event factory to generate content. Read Generate Common Base Event content with the default event factory for more information.
- If you do not wish to use the default event factory, you can create custom content handlers and event factories.
- Create a custom factory home. Read Create custom Common Base Event factory homes.
- Create a custom content handler. Read Create custom Common Base Event content handlers.
Results
After completing all the above steps you will have a Common Base event based on the configuration settings.
Related
Generate Common Base Event content with the default event factory
Common Base Event content handler
Create custom Common Base Event content handlers
Common Base Event factory home
Create custom Common Base Event factory homes
Common Base Event factory context
Common Base Event factory
Related
java.util.logging -- Java logging programming interface
Logger.properties file