public class CordysLogger
extends java.lang.Object
implements com.eibus.basicutil.Logger
| Modifier and Type | Method and Description |
|---|---|
static CordysLogger |
_getCordysLogger(java.lang.Class clazz,
com.eibus.util.logger.config.Log4JConfigurator log4JConfigurator)
Retrieve a CordysLogger according to the value of the
clazz parameter. |
static void |
_initializeDiagnosticContext()
Initializes the diagnostic context for the invoking thread.
|
void |
_log(java.lang.String callerFQCN,
Severity severity,
java.lang.Throwable exception,
java.lang.Object logMessage)
Internal method to log a special message record.
|
static void |
_popDiagnosticContext(java.lang.String name)
Clients should call this method before leaving a diagnostic context.
|
static void |
_pushDiagnosticContext(java.lang.String name,
java.lang.String value)
Push diagnostic context information for the current thread.
|
static void |
_removeDiagnosticContext()
Remove the diagnostic context for this thread.
|
void |
debug(int message)
Log a message Node with the
DEBUG Severity. |
void |
debug(int message,
java.lang.Throwable t)
Log a message Node with the
DEBUG Severity including the stack trace of the Throwable
t passed as parameter. |
void |
debug(com.eibus.localization.IStringResource message,
java.lang.Object... insertions)
Log IStringResource object with the
DEBUG Severity. |
void |
debug(java.lang.String message)
Log a message string with the
DEBUG Severity. |
void |
debug(java.lang.String message,
java.lang.Throwable t)
Log a message string with the
DEBUG Severity including the stack trace of the Throwable
t passed as parameter. |
void |
debug(java.lang.Throwable exception,
com.eibus.localization.IStringResource message,
java.lang.Object... insertions)
Log IStringResource object with the
DEBUG Severity including the stack trace of the Throwable
t passed as parameter. |
void |
error(int message)
Deprecated.
|
void |
error(int message,
java.lang.Throwable t)
Deprecated.
|
void |
error(java.lang.String message)
Deprecated.
|
void |
error(java.lang.String message,
java.lang.Throwable t)
Deprecated.
|
void |
error(java.lang.Throwable exception,
com.eibus.localization.IStringResource message,
java.lang.Object... insertions)
Log IStringResource object with the
ERROR Severity including the stack trace of the Throwable
t passed as parameter. |
void |
fatal(int message)
Deprecated.
|
void |
fatal(int message,
java.lang.Throwable t)
Deprecated.
|
void |
fatal(java.lang.String message)
Deprecated.
|
void |
fatal(java.lang.String message,
java.lang.Throwable t)
Deprecated.
|
void |
fatal(java.lang.Throwable exception,
com.eibus.localization.IStringResource message,
java.lang.Object... insertions)
Log IStringResource object with the
FATAL Severity including the stack trace of the Throwable
t passed as parameter. |
static CordysLogger |
getCordysLogger(java.lang.Class clazz)
Retrieve a CordysLogger according to the value of the
clazz parameter. |
static LoggerContext |
getLoggerContext()
This is for initiating the Composite Application Logger Context(CAL).
|
void |
info(int message)
Deprecated.
|
void |
info(int message,
java.lang.Throwable t)
Deprecated.
|
void |
info(com.eibus.localization.IStringResource message)
Log IStringResource object with the
INFO Severity. |
void |
info(com.eibus.localization.IStringResource message,
java.lang.Object... insertions)
Log IStringResource object with the
INFO Severity. |
void |
info(java.lang.String message)
Deprecated.
|
void |
info(java.lang.String message,
java.lang.Throwable t)
Deprecated.
|
void |
info(java.lang.Throwable exception,
com.eibus.localization.IStringResource message,
java.lang.Object... insertions)
Log IStringResource object with the
INFO Severity. |
boolean |
isDebugEnabled()
Check whether the category is enabled for the debug Severity.
|
boolean |
isEnabled(Severity severity)
Check whether the category is enabled for the specfied severiy.
|
boolean |
isErrorEnabled()
Deprecated.
|
boolean |
isFatalEnabled()
Deprecated.
|
boolean |
isInfoEnabled()
Check whether the category is enabled for the info Severity.
|
boolean |
isWarningEnabled()
Check whether the category is enabled for the warning Severity.
|
void |
log(Severity severity,
int message)
Deprecated.
Convert the XML node to string and use
log |
void |
log(Severity severity,
int message,
java.lang.Throwable t)
Deprecated.
Convert the XML node to string and use
log |
void |
log(Severity severity,
java.util.Map<java.lang.String,java.lang.String> contextMap,
java.lang.Throwable exception,
com.eibus.localization.IStringResource message,
java.lang.Object... insertions)
Log IStringResource with the specified Severity including the stack trace of the
Throwable t
passed as parameter. |
void |
log(Severity severity,
java.lang.Object message)
Deprecated.
Use
log |
void |
log(Severity severity,
java.lang.Object message,
java.lang.Throwable t)
Deprecated.
Use
log |
void |
log(Severity severity,
java.lang.String message)
Deprecated.
Use
log |
void |
log(Severity severity,
java.lang.String message,
java.lang.Throwable t)
Deprecated.
Use
log |
void |
log(Severity severity,
java.lang.Throwable exception,
com.eibus.localization.IStringResource message)
Log IStringResource with the specified Severity including the stack trace of the
Throwable t
passed as parameter. |
void |
log(Severity severity,
java.lang.Throwable exception,
com.eibus.localization.IStringResource message,
java.lang.Object... insertions)
Log IStringResource with the specified Severity including the stack trace of the
Throwable t
passed as parameter. |
void |
warn(int message)
Deprecated.
|
void |
warn(int message,
java.lang.Throwable t)
Deprecated.
|
void |
warn(java.lang.String message)
Deprecated.
|
void |
warn(java.lang.String message,
java.lang.Throwable t)
Deprecated.
|
void |
warn(java.lang.Throwable exception,
com.eibus.localization.IStringResource message,
java.lang.Object... insertions)
Log IStringResource object with the
WARN Severity including the stack trace of the Throwable
t passed as parameter. |
public static CordysLogger getCordysLogger(java.lang.Class clazz)
clazz parameter. If the parameter by name
CordysLogger already exists, then the existing instance will be returned. Otherwise, a new instance is created with
severity set to OFF.
default level of the CordysLogger will be OFF
public static CordysLogger _getCordysLogger(java.lang.Class clazz, com.eibus.util.logger.config.Log4JConfigurator log4JConfigurator)
clazz parameter. If the parameter by name
CordysLogger already exists, then the existing instance will be returned. Otherwise, a new instance is created with
severity set to OFF.
default level of the CordysLogger will be OFF
clazz - log4JConfigurator - public boolean isDebugEnabled()
true if this category is enabled for Severity debug, false otherwise.public boolean isInfoEnabled()
true if this category is enabled for Severity info, false otherwise.public boolean isWarningEnabled()
true if this category is enabled for Severity warning, false otherwise.public boolean isErrorEnabled()
true if this category is enabled for Severity error, false otherwise.public boolean isFatalEnabled()
true if this category is enabled for Severity FATAL, false otherwise.public boolean isEnabled(Severity severity)
severity - The severity of the logging request.true if this category is enabled for default Severity, false otherwise.public void log(Severity severity, int message)
logThis method first checks if this category is enabled by comparing the Severity of this category with the configured severity. If the category with severity is enabled, it converts the message to CordysLogRecord object, that contains information about userContext,MessageID, component etc . It proceeds to call all the registered appenders in this category .
severity - The severity of the logging request.message - the message Node to log.public void log(Severity severity, int message, java.lang.Throwable t)
logThrowable t
passed as parameter.severity - The severity of the logging request.message - the message Node to log.t - the exception to log, including its stack trace.public void log(Severity severity, java.lang.String message)
logThis method first checks if this category is enabled by comparing the Severity of this category with configured severity . If the category with severity is enabled,it converts the message to CordysLogRecord object, that containsinformation about userContext, MessageID, component etc . It proceeds to call all the registered appenders in this category .
severity - The severity of the logging request.message - the message string to log.public void log(Severity severity, java.lang.String message, java.lang.Throwable t)
logThrowable t
passed as parameter.message - the message String to log.t - the exception to log, including its stack trace.severity - The severity of the logging request.public void log(Severity severity, java.lang.Object message)
logThis method first checks if this category enabled by comparing the Severity of this category with configured severity . If the category is enabled,registered renderer convert the message object and proceeds to call all the registered appenders in this category .
severity - The severity of the logging request.message - the message object to log.public void log(Severity severity, java.lang.Object message, java.lang.Throwable t)
logThrowable t
passed as parameter.message - the message object to log.t - the exception to log, including its stack trace.severity - The severity of the logging request.public void info(int message)
INFO Severity.
This method first checks if this category is INFO enabled by comparing the Severity of this category
with INFO Severity. If the category is INFO enabled,it converts the message to
CordysLogRecord object, that contains information about userContext,MessageID, component etc . It proceeds to call
all the registered appenders in this category .
message - the message Node to log.public void info(int message,
java.lang.Throwable t)
INFO Severity including the stack trace of the Throwable
t passed as parameter.message - the message Node to log.t - the exception to log, including its stack trace.public void info(java.lang.String message)
INFO Severity.
This method first checks if this category is INFO enabled by comparing the Severity of this category
with INFO Severity. If the category is INFO enabled,it converts the message to
CordysLogRecord object, that contains information about userContext,MessageID, component etc . It proceeds to call
all the registered appenders in this category .
message - the message string to log.public void info(java.lang.String message,
java.lang.Throwable t)
INFO Severity including the stack trace of the Throwable
t passed as parameter.message - the message String to log.t - the exception to log, including its stack trace.public void debug(int message)
DEBUG Severity.
This method first checks if this category is DEBUG enabled by comparing the Severity of this category
with DEBUG Severity. If the category is DEBUG enabled,it converts the message
to CordysLogRecord object, that contains information about userContext,MessageID, component etc . It proceeds to
call all the registered appenders in this category .
message - the message Node to log.public void debug(int message,
java.lang.Throwable t)
DEBUG Severity including the stack trace of the Throwable
t passed as parameter.message - the message Node to log.t - the exception to log, including its stack trace.public void debug(com.eibus.localization.IStringResource message,
java.lang.Object... insertions)
DEBUG Severity.
This method first checks if this category is DEBUG enabled by comparing the Severity of this category
with DEBUG Severity. If the category is DEBUG enabled,it reads the object[]
arguments and insert that in to localized message in appropriate places . It proceeds to call all the registered
appenders in this category .
IStringResource - The message to log.insertions - insertions into the message.public void debug(java.lang.Throwable exception,
com.eibus.localization.IStringResource message,
java.lang.Object... insertions)
DEBUG Severity including the stack trace of the Throwable
t passed as parameter.
This method first checks if this category is DEBUG enabled by comparing the Severity of this category
with DEBUG Severity. If the category is DEBUG enabled,it reads the object[]
arguments and insert that in to localized message in appropriate places . It proceeds to call all the registered
appenders in this category .
debug in interface com.eibus.basicutil.Loggerexception - the exception to log, including its stack trace.IStringResource - The message to log.insertions - insertions into the message.public void debug(java.lang.String message)
DEBUG Severity.
This method first checks if this category is DEBUG enabled by comparing the Severity of this category
with DEBUG Severity. If the category is DEBUG enabled, it converts the message
to CordysLogRecord object, that contains information about userContext,MessageID, component etc . It proceeds to
call all the registered appenders in this category .
message - the message string to log.public void debug(java.lang.String message,
java.lang.Throwable t)
DEBUG Severity including the stack trace of the Throwable
t passed as parameter.message - the message string to log.t - the exception to log, including its stack trace.public void warn(int message)
WARN Severity.
This method first checks if this category is WARN enabled by comparing the Severity of this category
with WARN Severity. If the category is WARN enabled, it converts the message to
CordysLogRecord object, that contains information about userContext,MessageID, component etc . It proceeds to call
all the registered appenders in this category .
message - the message Node to log.public void warn(int message,
java.lang.Throwable t)
WARN Severity including the stack trace of the Throwable
t passed as parameter.message - the message Node to log.t - the exception to log, including its stack trace.public void warn(java.lang.String message)
WARN Severity.
This method first checks if this category is DEBUG enabled by comparing the Severity of this category
with WARN Severity. If the category is WARN enabled , it converts the message to
CordysLogRecord object, that contains information about userContext,MessageID, component etc . It proceeds to call
all the registered appenders in this category .
message - the message string to log.public void warn(java.lang.String message,
java.lang.Throwable t)
WARN Severity including the stack trace of the Throwable
t passed as parameter.message - the message string to log.t - the exception to log, including its stack trace.public void error(int message)
ERROR Severity.
This method first checks if this category is ERROR enabled by comparing the Severity of this category
with WARN Severity. If the category is ERROR enabled, it converts the message to
CordysLogRecord object, that contains information about userContext,MessageID, component etc . It proceeds to call
all the registered appenders in this category .
message - the message Node to log.public void error(int message,
java.lang.Throwable t)
ERROR Severity including the stack trace of the Throwable
t passed as parameter.message - the message Node to log.t - the exception to log, including its stack trace.public void error(java.lang.String message)
ERROR Severity.
This method first checks if this category is ERROR enabled by comparing the Severity of this category
with ERROR Severity. If the category is ERROR enabled, it converts the message
to CordysLogRecord object, that contains information about userContext,MessageID, component etc . It proceeds to
call all the registered appenders in this category .
message - the message string to log.public void error(java.lang.String message,
java.lang.Throwable t)
ERROR Severity including the stack trace of the Throwable
t passed as parameter.message - the message string to log.t - the exception to log, including its stack trace.public void fatal(int message)
FATAL Severity.
This method first checks if this category is FATAL enabled by comparing the Severity of this category
with WARN Severity. If the category is FATAL enabled, it converts the message to
CordysLogRecord object, that contains information about userContext,MessageID, component etc . It proceeds to call
all the registered appenders in this category .
message - the message Node to log.public void fatal(int message,
java.lang.Throwable t)
FATAL Severity including the stack trace of the Throwable
t passed as parameter.message - the message Node to log.t - the exception to log, including its stack trace.public void fatal(java.lang.String message)
FATAL Severity.
This method first checks if this category is FATAL enabled by comparing the Severity of this category
with FATAL Severity. If the category is FATAL enabled,it converts the message
to CordysLogRecord object, that contains information about userContext,MessageID, component etc . It proceeds to
call all the registered appenders in this category .
message - the message string to log.public void fatal(java.lang.String message,
java.lang.Throwable t)
FATAL Severity including the stack trace of the Throwable
t passed as parameter.message - the message string to log.t - the exception to log, including its stack trace.public void log(Severity severity, java.lang.Throwable exception, com.eibus.localization.IStringResource message)
Throwable t
passed as parameter.
This method first checks if this category is enabled by comparing the Severity of this category with the configured severity. If the category with severity is enabled, It proceeds to call all the registered appenders in this category .
severity - The severity of the logging request.t - the exception to log, including its stack trace.IStringResource - The message to log.public void log(Severity severity, java.lang.Throwable exception, com.eibus.localization.IStringResource message, java.lang.Object... insertions)
Throwable t
passed as parameter.
This method first checks if this category is enabled by comparing the Severity of this category with the configured severity. If the category with severity is enabled, it reads the object[] arguments and insert that in to localized message in appropriate places . It proceeds to call all the registered appenders in this category .
severity - The severity of the logging request.exception - the exception to log, including its stack trace.IStringResource - The message to log.insertions - insertions into the message.public void log(Severity severity, java.util.Map<java.lang.String,java.lang.String> contextMap, java.lang.Throwable exception, com.eibus.localization.IStringResource message, java.lang.Object... insertions)
Throwable t
passed as parameter.
This method forcibly logs the message with the given severity.It reads the object[] arguments and insert that in to localized message in appropriate places . It proceeds to call all the registered appenders in this category .
severity - The severity of the logging request.contextMap - The contextMap to push the information into the Diagnostic Context.exception - the exception to log, including its stack trace.IStringResource - The message to log.insertions - insertions into the message.public void info(com.eibus.localization.IStringResource message)
INFO Severity.
This method first checks if this category is INFO enabled by comparing the Severity of this category
with INFO Severity. If the category is INFO enabled, It proceeds to call all the
registered appenders in this category .
IStringResource - The message to log.public void info(java.lang.Throwable exception,
com.eibus.localization.IStringResource message,
java.lang.Object... insertions)
INFO Severity.
This method first checks if this category is INFO enabled by comparing the Severity of this category
with INFO Severity. If the category is INFO enabled,it reads the object[]
arguments , if not null and insert that in to localized message in appropriate places . It proceeds to call all the
registered appenders in this category .
info in interface com.eibus.basicutil.Loggerexception - the exception to log, including its stack trace.IStringResource - The message to log.insertions - insertions into the message.public void info(com.eibus.localization.IStringResource message,
java.lang.Object... insertions)
INFO Severity.
This method first checks if this category is INFO enabled by comparing the Severity of this category
with INFO Severity. If the category is INFO enabled,it reads the object[]
arguments , if not null and insert that in to localized message in appropriate places . It proceeds to call all the
registered appenders in this category .
IStringResource - The message to log.insertions - insertions into the message.public void warn(java.lang.Throwable exception,
com.eibus.localization.IStringResource message,
java.lang.Object... insertions)
WARN Severity including the stack trace of the Throwable
t passed as parameter.
This method first checks if this category is WARN enabled by comparing the Severity of this category
with WARN Severity. If the category is WARN enabled,it reads the object[]
arguments and insert that in to localized message in appropriate places . It proceeds to call all the registered
appenders in this category .
warn in interface com.eibus.basicutil.Loggerexception - the exception to log, including its stack trace.IStringResource - The message to log.insertions - insertions into the message.public void error(java.lang.Throwable exception,
com.eibus.localization.IStringResource message,
java.lang.Object... insertions)
ERROR Severity including the stack trace of the Throwable
t passed as parameter.
This method first checks if this category is ERROR enabled by comparing the Severity of this category
with ERROR Severity. If the category is ERROR enabled,it reads the object[]
arguments and insert that in to localized message in appropriate places . It proceeds to call all the registered
appenders in this category .
error in interface com.eibus.basicutil.Loggerexception - the exception to log, including its stack trace.IStringResource - The message to log.insertions - insertions into the message.public void fatal(java.lang.Throwable exception,
com.eibus.localization.IStringResource message,
java.lang.Object... insertions)
FATAL Severity including the stack trace of the Throwable
t passed as parameter.
This method first checks if this category is FATAL enabled by comparing the Severity of this category
with ERROR Severity. If the category is FATAL enabled,it reads the object[]
arguments and insert that in to localized message in appropriate places . It proceeds to call all the registered
appenders in this category .
fatal in interface com.eibus.basicutil.Loggerexception - the exception to log, including its stack trace.IStringResource - The message to log.insertions - insertions into the message.public void _log(java.lang.String callerFQCN,
Severity severity,
java.lang.Throwable exception,
java.lang.Object logMessage)
callerFQCN - The wrapper class' fully qualified class nameseverity - the severity of the log messageexception - the related exceptionlogMessage - the log message itselfpublic static void _pushDiagnosticContext(java.lang.String name,
java.lang.String value)
The contents of the message parameter is determined solely by the client.
message - The transaction context information.public static void _popDiagnosticContext(java.lang.String name)
There is no penalty for forgetting to match each push operation with a corresponding pop, except the obvious mismatch between the real application context and the context set in by Cordys Logger.
public static void _removeDiagnosticContext()
Each thread that created a diagnostic context by calling _pushDiagnosticContext() should call this method before exiting. Otherwise, the memory used by the thread cannot be reclaimed by the VM.
public static void _initializeDiagnosticContext()
Certain default diagnostic context is initialized by the Cordys Logger. To avail them, a thread must invoke this method. It is important to invoke the method _removeDiagnosticContext() when a thread is ready to quit to avoid memory leak.
public static LoggerContext getLoggerContext()
LoggerContext loggerContext = CordysLogger.getLoggerContext();
loggerContext.addDiagnosticContext("context", "my sample application");