|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public Logger
A Logger object is used to log messages for a specific system or application component. Loggers are normally named, using a hierarchical dot-separated namespace. Logger names can be arbitrary strings, but they should normally be based on the package name or class name of the logged component, such as com.ibm.mm.enabler or com.ibm.mm.enabler.services.ConfigService.
Logger objects may be obtained by calls on one of the getLogger factory methods. These will either create a new Logger or return a suitable existing Logger.
Logging messages will be forwarded to registered Handler objects, which can forward the messages to a variety of destinations, including consoles, files, OS logs, etc.
Each Logger keeps track of a "parent" Logger, which is its nearest existing ancestor in the Logger namespace. The default Enabler logging framework uses only one parent logger, the "root Logger"
On each logging call the Logger initially performs a cheap check of the request level (e.g. SEVERE or TRACE) against the effective global log level for the logger. If the request level is lower than the log level, the logging call returns immediately.
After passing this initial (cheap) test, the Logger will publish a the specified paramters to its output Handlers. By default, if the logger is not the root logger, it also publishes to it's parent's Handlers.
Most of the logger output methods take a "message" argument. This message argument may be either a raw value or a format string. During formatting, the format string will be filled in with the specified parameters. Otherwise the original message string is used. Typically the logger uses dojo.string.substitute style formatting to format parameters, so for example a format string "$
{
0} $
{
1}" would format two parameters as strings.
A global JS object can be used to configure the loggers that are considered for tracing.
This object is named traceConfig
and can be accessed through the ConfigService
or initialized by ConfigService.properties
[ "com.ibm.mashups.*", "com.ibm.mm.*" ]
isDebug
Flag must be set to true
.
Method Summary | |
---|---|
void |
addHandler(LogHandler handler)
Adds a handler to the handler chain, so that it is capable of receiving events from the logging framework. |
void |
removeHandler(LogHandler handler)
Removes a handler from the handler chain and unsubscribing it from the logging framework events. |
Method Detail |
---|
void addHandler(LogHandler handler)
handler
-
the LogHandler to subscribe to the specific logging events.void removeHandler(LogHandler handler)
handler
-
the LogHandler to unsubscribe to the specific logging events.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |