Naming and managing loggers

This section discusses considerations for naming and managing loggers.

WebSphere JRas loggers have no predefined granularity or scope. An application consisting of many different classes can be instrumented by using a single logger, can be subdivided into several components with a logger for each component, or can have a logger for each class.

Loggers are named objects; the manager maintains a hierarchical name space of loggers, with separate name spaces for message loggers and trace loggers. For each unique logger name, the logger instance is created on the first request to the manager and the same instance is returned on subsequent calls. The following recommendations apply to naming loggers:

The WebSphere run time and system-management utilities enable you to enable and disable trace at any level of the name-space hierarchy. Changing the trace state at any level of the hierarchy automatically makes the same state change for all child levels. For instance, enabling trace at the middle level of a hierarchy automatically enables trace for all levels below the middle level.

Trace loggers can be combined into logical sets called groups to track events across various components of an application. For example, if an application contains three different components, you can create a group that includes trace loggers from each component, thereby providing a way to trace the flow of a particular function across all three components. Application developers must provide group names that are unique to the application and that do not conflict with other group names in the name space, including names used by the WebSphere run time.

JRas objects are managed by the WebSphere run time. When a logger is created, the JRas manager queries the WebSphere system-management utility to determine the initial state for the logger's mask. The state of the mask is updated dynamically in accordance with settings provided to the system-management utility. The default initial states for the different types of loggers are as follows: