Set the logger hierarchy
WAS handlers are attached to the Java root logger, which is at the top of the logger hierarchy. As a result, any request from anywhere in the logger tree can be processed by WAS handlers.
Configure the appserver to handle logs in many different ways. Set the log settings based upon the configuration and the logging structure that best suits the needs.
- Forward all application logging requests to the WAS handlers. This behavior is the default.
- Forward all application logging requests to our own custom handlers.
Set the useParentHandlers option to false on one of the custom loggers, and then attach the handlers to that logger.
- Forward all application logging requests to both WAS handlers, and the custom handlers, but do not forward WAS logging requests to the custom handlers. Set the useParentHandlers option to true on one of the non-root custom loggers, and then attach the handlers to that logger.True is the default setting.
- Forward all WAS logging requests to both WAS handlers, and the custom handlers. Logging requests are always forwarded to WAS handlers. To forward WAS requests to the custom handlers, attach the custom handlers to the Java root logger, so that they are at the same level in the hierarchy as the WAS handlers.
Example
The following example shows how these requirements can be met using the Java logging infrastructure:
Related tasks
Use a logger
Create log resource bundles and message files
Related
Example: Creating custom log handlers with java.util.logging
Example: Creating custom filters with java.util.logging
Example: Creating custom formatters with java.util.logging
Example: Adding custom handlers, filters, and formatters