|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.metamatrix.common.log.LogManager
public final class LogManager
This class represents the interface to a single logging framework that is easily accessible by any component. Using the LogManager, a component can quickly submit a log message, and can rely upon the LogManager to determine (a) whether that message is to be recorded or discarded; and (b) where to send any recorded messages. Thus, the component's code that submits messages does not have to be modified to alter the logging behavior of the application.
By default, all context(s) are logged by the LogManager. The messages that the LogManager actually records and sends to the destinations can be controlled using two different and orthogonal parameters. The first is a message level that filters messages based upon detail, and the second is a message context that filters messages based upon origin. The LogManager tracks only those context(s) that should NOT be logged. Only if a message (which also is defined with these two parameters) passes both filters will it be sent to the destinations.
Each message is submitted with one of the following levels (determined by the particular method used to submit the message), sorted from the least detailed to the greatest:
The context for a message is any application-specified String. Again, only those message contexts that match those in the LogManager's configuration will be sent to the destinations.
Constructor Summary | |
---|---|
LogManager()
|
Method Summary | |
---|---|
static java.lang.Object |
createLoggingProxy(java.lang.String loggingContext,
java.lang.Object instance,
java.lang.Class[] interfaces,
int level)
|
static LogConfiguration |
getLogConfigurationCopy()
Utility method to obtain the a modifiable log configuration for the LogManager. |
static boolean |
isMessageToBeRecorded(java.lang.String context,
int msgLevel)
Utility method to identify whether a log message with the specified context and level will be recorded in the LogManager's destinations. |
static void |
log(int msgLevel,
java.lang.String context,
java.lang.String message)
Send a message of the specified level to the log. |
static void |
log(int msgLevel,
java.lang.String context,
java.lang.Throwable e,
java.lang.String message)
Send a message of the specified level to the log. |
static void |
logCritical(java.lang.String context,
java.lang.String message)
Send a critical message to the log. |
static void |
logCritical(java.lang.String context,
java.lang.Throwable e,
java.lang.String message)
Send a critical message to the log. |
static void |
logDetail(java.lang.String context,
java.lang.Object... msgParts)
Send a detail message to the log. |
static void |
logDetail(java.lang.String context,
java.lang.Throwable e,
java.lang.String message)
Send a detail message to the log. |
static void |
logError(java.lang.String context,
java.lang.String message)
Send an error message to the log. |
static void |
logError(java.lang.String context,
java.lang.Throwable e,
java.lang.String message)
Send an error message to the log. |
static void |
logInfo(java.lang.String context,
java.lang.String message)
Send a information message to the log. |
static void |
logTrace(java.lang.String context,
java.lang.Object... msgParts)
Send a trace message to the log. |
static void |
logTrace(java.lang.String context,
java.lang.Throwable e,
java.lang.Object... msgParts)
Send a trace message to the log. |
static void |
logWarning(java.lang.String context,
java.lang.String message)
Send a warning message to the log. |
static void |
logWarning(java.lang.String context,
java.lang.Throwable e,
java.lang.String message)
Send a warning message to the log. |
static void |
setLogConfiguration(LogConfiguration config)
|
static void |
setLogListener(LogListener listener)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public LogManager()
Method Detail |
---|
public static void logCritical(java.lang.String context, java.lang.String message)
Only if the log manager is configured to send such messages to the destination will the message be recorded.
context
- the context for this log message (for example, the component
that is generating this message).message
- the log message; the message is
not logged if this parameter is nullpublic static void logCritical(java.lang.String context, java.lang.Throwable e, java.lang.String message)
Only if the log manager is configured to send such messages to the destination will the message be recorded.
context
- the context for this log message (for example, the component
that is generating this message).e
- the exception that is to be logged; the message is
not logged if this parameter is nullmessage
- the log message (may be null)public static void logError(java.lang.String context, java.lang.String message)
Only if the log manager is configured to send such messages to the destination will the message be recorded.
context
- the context for this log message (for example, the component
that is generating this message).message
- the log message; the message is
not logged if this parameter is nullpublic static void logError(java.lang.String context, java.lang.Throwable e, java.lang.String message)
Only if the log manager is configured to send such messages to the destination will the message be recorded.
context
- the context for this log message (for example, the component
that is generating this message).e
- the exception that is to be logged; the message is
not logged if this parameter is nullmessage
- the log message (may be null)public static void logWarning(java.lang.String context, java.lang.String message)
Only if the log manager is configured to send such messages to the destination will the message be recorded.
context
- the context for this log message (for example, the component
that is generating this message).message
- the log message; the message is
not logged if this parameter is nullpublic static void logWarning(java.lang.String context, java.lang.Throwable e, java.lang.String message)
Only if the log manager is configured to send such messages to the destination will the message be recorded.
context
- the context for this log message (for example, the component
that is generating this message).e
- the exception that is to be logged; the message is
not logged if this parameter is nullmessage
- the log message (may be null)public static void logInfo(java.lang.String context, java.lang.String message)
Only if the log manager is configured to send such messages to the destination will the message be recorded.
context
- the context for this log message (for example, the component
that is generating this message).message
- the log message; the message is
not logged if this parameter is nullpublic static void logDetail(java.lang.String context, java.lang.Object... msgParts)
Only if the log manager is configured to send such messages to the destination will the message be recorded.
context
- the context for this log message (for example, the component
that is generating this message).msgParts
- the individual parts of the log message; the message is
not logged if this parameter is nullpublic static void logDetail(java.lang.String context, java.lang.Throwable e, java.lang.String message)
Only if the log manager is configured to send such messages to the destination will the message be recorded.
context
- the context for this log message (for example, the component
that is generating this message).e
- the exception that is to be logged; the message is
not logged if this parameter is nullmessage
- the log message (may be null)public static void logTrace(java.lang.String context, java.lang.Object... msgParts)
Only if the log manager is configured to send such messages to the destination will the message be recorded.
context
- the context for this log message (for example, the component
that is generating this message).msgParts
- the individual parts of the log message; the message is
not logged if this parameter is nullpublic static void logTrace(java.lang.String context, java.lang.Throwable e, java.lang.Object... msgParts)
Only if the log manager is configured to send such messages to the destination will the message be recorded.
context
- the context for this log message (for example, the component
that is generating this message).e
- the exception that is to be logged; the message is
not logged if this parameter is nullmsgParts
- the individual parts of the log message (may be null)public static void log(int msgLevel, java.lang.String context, java.lang.String message)
Only if the log manager is configured to send such messages to the destination will the message be recorded.
msgLevel
- context
- the context for this log message (for example, the component
that is generating this message).message
- the individual parts of the log message; the message is
not logged if this parameter is nullpublic static void log(int msgLevel, java.lang.String context, java.lang.Throwable e, java.lang.String message)
Only if the log manager is configured to send such messages to the destination will the message be recorded.
context
- the context for this log message (for example, the component
that is generating this message).e
- the exception that is to be logged; the message is
not logged if this parameter is nullmessage
- the individual parts of the log message; the message is
not logged if this parameter is nullpublic static LogConfiguration getLogConfigurationCopy()
After modifying the log config, user must call setLogConfiguration(LogConfiguration)
to
affect the logging configuration.
public static void setLogConfiguration(LogConfiguration config)
public static void setLogListener(LogListener listener)
public static boolean isMessageToBeRecorded(java.lang.String context, int msgLevel)
context
- msgLevel
-
public static java.lang.Object createLoggingProxy(java.lang.String loggingContext, java.lang.Object instance, java.lang.Class[] interfaces, int level)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |