public final class LogManager extends Object
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.
Modifier and Type | Class and Description |
---|---|
static class |
LogManager.LoggingProxy |
Constructor and Description |
---|
LogManager() |
Modifier and Type | Method and Description |
---|---|
static Object |
createLoggingProxy(String loggingContext,
Object instance,
Class<?>[] interfaces,
int level)
Create a logging proxy, that logs at entry and exit points of the method calls on the provided interfaces.
|
static Object |
createLoggingProxy(String loggingContext,
Object instance,
Class<?>[] interfaces,
int level,
ClassLoader classLoader) |
static boolean |
isMessageToBeRecorded(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,
String context,
Object message)
Send a message of the specified level to the log.
|
static void |
log(int msgLevel,
String context,
Throwable e,
Object... message)
Send a message of the specified level to the log.
|
static void |
logCritical(String context,
Object message)
Send a critical message to the log.
|
static void |
logCritical(String context,
Throwable e,
Object message)
Send a critical message to the log.
|
static void |
logDetail(String context,
Object... msgParts) |
static void |
logDetail(String context,
Object msgPart)
Send a detail message to the log.
|
static void |
logDetail(String context,
Object msgPart,
Object msgPart1) |
static void |
logDetail(String context,
Object msgPart,
Object msgPart1,
Object msgPart2) |
static void |
logDetail(String context,
Throwable e,
Object... message)
Send a detail message to the log.
|
static void |
logError(String context,
Object message)
Send an error message to the log.
|
static void |
logError(String context,
Throwable e,
Object message)
Send an error message to the log.
|
static void |
logInfo(String context,
Object message)
Send a information message to the log.
|
static void |
logTrace(String context,
Object... msgParts)
Send a trace message to the log.
|
static void |
logTrace(String context,
Object msgPart) |
static void |
logTrace(String context,
Object msgPart,
Object msgPart1) |
static void |
logTrace(String context,
Object msgPart,
Object msgPart1,
Object msgPart2) |
static void |
logTrace(String context,
Throwable e,
Object... msgParts)
Send a trace message to the log.
|
static void |
logWarning(String context,
Object message)
Send a warning message to the log.
|
static void |
logWarning(String context,
Throwable e,
Object message)
Send a warning message to the log.
|
static void |
putMdc(String key,
String val) |
static void |
removeMdc(String key) |
static Logger |
setLogListener(Logger listener) |
public static void logCritical(String context, Object 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(String context, Throwable e, Object 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(String context, Object 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(String context, Throwable e, Object 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(String context, Object 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(String context, Throwable e, Object 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(String context, Object 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(String context, Object msgPart)
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(String context, Object msgPart, Object msgPart1, Object msgPart2)
public static void logDetail(String context, Throwable e, Object... 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(String context, 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(String context, Object msgPart, Object msgPart1, Object msgPart2)
public static void logTrace(String context, Throwable e, 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, String context, Object 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, String context, Throwable e, Object... 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 boolean isMessageToBeRecorded(String context, int msgLevel)
context
- msgLevel
- public static Object createLoggingProxy(String loggingContext, Object instance, Class<?>[] interfaces, int level)
public static Object createLoggingProxy(String loggingContext, Object instance, Class<?>[] interfaces, int level, ClassLoader classLoader)
public static void removeMdc(String key)
Copyright © 2018 JBoss by Red Hat. All rights reserved.