|
||||||||||
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 | |
---|---|
Logger |
getLogger(String loggerName)
Find or create a logger for a named subsystem. |
void |
entering(String methodName,
Object[] args)
This is a convenience method that can be used to log entry to a method. |
void |
exiting(String methodName,
Object[] args)
This is a convenience method that can be used to log returning of a method. |
void |
info(String methodName,
String message,
Object[] args)
This method allows components to log an INFO level event. |
void |
warning(String methodName,
String message,
Object[] args)
This method allows components to log an WARNING level event. |
void |
severe(String methodName,
String message,
Object[] args)
This method allows components to log an SEVERE level event. |
void |
trace(String methodName,
String message,
Object[] args)
This method allows components to log an TRACE level event. |
void |
log(int logLevel,
String methodName,
String message,
Object[] args)
This method allows components to log a logging event for the specified LogLevel |
boolean |
isLoggable(int logLevel)
Check if a message of the given level would actually be logged by this logger. |
Method Detail |
---|
Logger getLogger(String loggerName)
loggerName
-
A name for the logger. This should be a dot-separated name and should normally be based on the package name or class name of the subsystem, such as com.ibm.mm.enabler or com.ibm.mm.enabler.services.ConfigService
void entering(String methodName, Object[] args)
methodName
-
the name of the method .args
-
array of arguments that's passed into the method. Those arguments will be added to the entering comment in a comma separated way.void exiting(String methodName, Object[] args)
methodName
-
the name of the method .args
-
array of arguments that's passed into the method. Those arguments will be added to the exiting comment in a comma separated way.void info(String methodName, String message, Object[] args)
methodName
-
the name of the method .message
-
the message that you want to log.args
-
array of arguments that's passed into the method. Those arguments will be filled into the wildcards in your message.void warning(String methodName, String message, Object[] args)
methodName
-
the name of the method .message
-
the message that you want to log.args
-
array of arguments that's passed into the method. Those arguments will be filled into the wildcards in your message.void severe(String methodName, String message, Object[] args)
methodName
-
the name of the method .message
-
the message that you want to log.args
-
array of arguments that's passed into the method. Those arguments will be filled into the wildcards in your message.void trace(String methodName, String message, Object[] args)
methodName
-
the name of the method .message
-
the message that you want to log.args
-
array of arguments that's passed into the method. Those arguments will be filled into the wildcards in your message.void log(int logLevel, String methodName, String message, Object[] args)
LogLevel
logLevel
-
the LogLevel
to use for logging.methodName
-
the name of the method.message
-
the message that you want to log.args
-
array of arguments that's passed into the method. Those arguments will be filled into the wildcards in your message.boolean isLoggable(int logLevel)
logLevel
-
the LogLevel
to check
true
if the given message level is currently being logged.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |