Platform SDK Java 8.5 API Reference

com.genesyslab.platform.apptemplate.lmslogger
Class AbstractLmsEventLogger

java.lang.Object
  extended by com.genesyslab.platform.commons.log.AbstractLogger
      extended by com.genesyslab.platform.apptemplate.lmslogger.AbstractLmsEventLogger
All Implemented Interfaces:
ILoggerEx, LmsEventLogger, ILogger
Direct Known Subclasses:
DirectLmsEventLogger, JulLmsEventLogger, Log4j2LmsEventLogger, Log4jLmsEventLogger, SimpleLmsEventLogger, Slf4jLmsEventLogger

public abstract class AbstractLmsEventLogger
extends AbstractLogger
implements LmsEventLogger

Abstract base class with common methods implementation of LmsEventLogger interface.

See Also:
LmsLoggerFactory.getLogger(Class), LmsLoggerFactory.getLogger(String)

Nested Class Summary
 
Nested classes/interfaces inherited from class com.genesyslab.platform.commons.log.AbstractLogger
AbstractLogger.Level
 
Field Summary
protected static java.lang.String CTX_ATTRMAP_PREFIX
           
protected static java.lang.String CTX_LMSATTR_CATEGORY
           
protected static java.lang.String CTX_LMSATTR_ID
           
protected static java.lang.String CTX_LMSATTR_LEVEL
           
protected static java.lang.String CTX_LMSATTR_NAME
           
protected static java.lang.String CTX_LMSATTR_PREFIX
           
protected static LmsMessageTemplate DEFAULT_LMS_EVENT
           
protected  LmsMessageConveyor lmsMessages
           
protected static java.lang.String LOG_WRAPPER_FQCN
           
protected  boolean printAttributes
           
 
Fields inherited from interface com.genesyslab.platform.apptemplate.lmslogger.LmsEventLogger
STR_PSDK_LMS_ALARM_MESSAGE_MARKER, STR_PSDK_LMS_MESSAGE_MARKER
 
Constructor Summary
protected AbstractLmsEventLogger(LmsMessageConveyor imc)
           
 
Method Summary
 void debug(LmsMessageTemplate key, java.lang.Object... args)
          Logs localized LMS event as a debug message.
 void debug(LogCategory category, LmsMessageTemplate key, java.lang.Object... args)
          Logs localized LMS event as a debug message.
 void debug(java.lang.Object message)
          Logs a message at the DEBUG level.
 void debug(java.lang.Object message, java.lang.Throwable e)
          Logs a message at the DEBUG level including the stack trace of the Throwable thr passed as parameter.
 void debug(java.lang.String message, java.lang.Object... args)
          Logs formatted debug message with optional arguments.
protected abstract  void doLogEvent(LogCategory category, AbstractLogger.Level logLevel, LmsMessageTemplate key, java.lang.Object... args)
          Logs a localized message.
Specific LmsEventLogger class should implement this method to process log messages.
 void error(LmsMessageTemplate key, java.lang.Object... args)
          Logs localized LMS event as an error message.
 void error(LogCategory category, LmsMessageTemplate key, java.lang.Object... args)
          Logs localized LMS event as an error message.
 void error(java.lang.Object message)
          Logs a message at the ERROR level.
 void error(java.lang.Object message, java.lang.Throwable e)
          Logs a message at the ERROR level including the stack trace of the Throwable thr passed as parameter.
 void error(java.lang.String message, java.lang.Object... args)
          Logs a message at the ERROR level.
To format log messages PSDK uses MessageFormat class.
Quick examples on the rules of formatting:
 void fatal(LmsMessageTemplate key, java.lang.Object... args)
          Logs localized LMS event as a fatal error message.
 void fatal(LogCategory category, LmsMessageTemplate key, java.lang.Object... args)
          Logs localized LMS event as a fatal error message.
 void fatal(java.lang.String message, java.lang.Object... args)
          Logs a message at the FATAL ERROR level.
To format log messages PSDK uses MessageFormat class.
Quick examples on the rules of formatting:
 void fatalError(LmsMessageTemplate key, java.lang.Object... args)
          Logs localized LMS event as a fatal error message.
 void fatalError(LogCategory category, LmsMessageTemplate key, java.lang.Object... args)
          Logs localized LMS event as a fatal error message.
 void fatalError(java.lang.Object message)
          Logs a message object with the FATAL ERROR level.
 void fatalError(java.lang.Object message, java.lang.Throwable e)
          Logs a message at the FATAL ERROR level including the stack trace of the Throwable thr passed as parameter.
protected static java.lang.Throwable getThrowableArg(java.lang.Object... args)
          Returns the last argument value as Throwable.
 void info(LmsMessageTemplate key, java.lang.Object... args)
          Logs localized LMS event as an info message.
 void info(LogCategory category, LmsMessageTemplate key, java.lang.Object... args)
          Logs localized LMS event as an info message.
 void info(java.lang.Object message)
          Logs a message at the INFO level.
 void info(java.lang.Object message, java.lang.Throwable e)
          Logs a message at the INFO level including the stack trace of the Throwable thr passed as parameter.
 void info(java.lang.String message, java.lang.Object... args)
          Logs a message at the INFO level.
To format log messages PSDK uses MessageFormat class.
Quick examples on the rules of formatting:
 void log(int key, java.lang.Object... args)
          Logs a localized message.
Its usage may look like:
 void log(LmsMessageTemplate key, java.lang.Object... args)
          Logs a localized message.
Its usage may look like:
 void log(LogCategory category, int key, java.lang.Object... args)
          Logs a localized message.
Its usage may look like:
 void log(LogCategory category, LmsMessageTemplate key, java.lang.Object... args)
          Logs a localized message.
Its usage may look like:
 void trace(java.lang.String message, java.lang.Object... args)
          Logs formatted trace message with optional arguments.
 void warn(LmsMessageTemplate key, java.lang.Object... args)
          Logs localized LMS event as a warning message.
 void warn(LogCategory category, LmsMessageTemplate key, java.lang.Object... args)
          Logs localized LMS event as a warning message.
 void warn(java.lang.Object message)
          Logs a message at the WARNING level.
 void warn(java.lang.Object message, java.lang.Throwable e)
          Logs a message at the WARNING level including the stack trace of the Throwable thr passed as parameter.
 void warn(java.lang.String message, java.lang.Object... args)
          Logs a message at the WARNING level.
To format log messages PSDK uses MessageFormat class.
Quick examples on the rules of formatting:
 
Methods inherited from class com.genesyslab.platform.commons.log.AbstractLogger
debugFormat, errorFormat, fatalErrorFormat, formatMessage, infoFormat, log, logArgs, warnFormat
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.genesyslab.platform.commons.log.ILogger
createChildLogger, debugFormat, errorFormat, fatalErrorFormat, infoFormat, isDebug, isError, isFatalError, isInfo, isWarn, warnFormat
 

Field Detail

CTX_LMSATTR_ID

protected static final java.lang.String CTX_LMSATTR_ID
See Also:
Constant Field Values

CTX_LMSATTR_NAME

protected static final java.lang.String CTX_LMSATTR_NAME
See Also:
Constant Field Values

CTX_LMSATTR_LEVEL

protected static final java.lang.String CTX_LMSATTR_LEVEL
See Also:
Constant Field Values

CTX_LMSATTR_CATEGORY

protected static final java.lang.String CTX_LMSATTR_CATEGORY
See Also:
Constant Field Values

CTX_LMSATTR_PREFIX

protected static final java.lang.String CTX_LMSATTR_PREFIX
See Also:
Constant Field Values

CTX_ATTRMAP_PREFIX

protected static final java.lang.String CTX_ATTRMAP_PREFIX
See Also:
Constant Field Values

LOG_WRAPPER_FQCN

protected static final java.lang.String LOG_WRAPPER_FQCN
See Also:
Constant Field Values

DEFAULT_LMS_EVENT

protected static final LmsMessageTemplate DEFAULT_LMS_EVENT

lmsMessages

protected final LmsMessageConveyor lmsMessages

printAttributes

protected final boolean printAttributes
Constructor Detail

AbstractLmsEventLogger

protected AbstractLmsEventLogger(LmsMessageConveyor imc)
Method Detail

log

public void log(LogCategory category,
                LmsMessageTemplate key,
                java.lang.Object... args)
Logs a localized message.
Its usage may look like:
 lmsLogger.log(LogCategory.Application, CommonLmsEnum.GCTI_APP_STARTED);
 lmsLogger.log(LogCategory.Application, CommonLmsEnum.GCTI_LOAD_RESOURCE, rcName, errCode);
 

Specified by:
log in interface LmsEventLogger
Parameters:
category - the log event category.
key - the key used for localization.
args - optional arguments.

log

public void log(LogCategory category,
                int key,
                java.lang.Object... args)
Logs a localized message.
Its usage may look like:
 lmsLogger.log(LogCategory.Application, 5060);                  // CommonLmsEnum.GCTI_APP_STARTED
 lmsLogger.log(LogCategory.Application, 2002, rcName, errCode); // CommonLmsEnum.GCTI_LOAD_RESOURCE
 

Specified by:
log in interface LmsEventLogger
Parameters:
category - the log event category.
key - the key used for localization.
args - optional arguments.

log

public void log(LmsMessageTemplate key,
                java.lang.Object... args)
Logs a localized message.
Its usage may look like:
 lmsLogger.log(CommonLmsEnum.GCTI_APP_STARTED);
 lmsLogger.log(CommonLmsEnum.GCTI_LOAD_RESOURCE, rcName, errCode);
 

Specified by:
log in interface LmsEventLogger
Parameters:
key - the key used for localization.
args - optional arguments.

log

public void log(int key,
                java.lang.Object... args)
Logs a localized message.
Its usage may look like:
 lmsLogger.log(5060);                  // CommonLmsEnum.GCTI_APP_STARTED
 lmsLogger.log(2002, rcName, errCode); // CommonLmsEnum.GCTI_LOAD_RESOURCE
 

Specified by:
log in interface LmsEventLogger
Parameters:
key - the key used for localization.
args - optional arguments.

fatalError

public void fatalError(java.lang.Object message)
Logs a message object with the FATAL ERROR level.

Note: Some of PSDK supported logging frameworks (namely "Slf4J" and "java.util.logging") do not support FATAL ERROR messages level.
So, in Slf4J logging adapter PSDK marks such messages with "PSDK_FATAL_MESSAGE" marker.
And in java.util.logging adapter this level is processed as ERROR (SEVERE).

Specified by:
fatalError in interface ILogger
Overrides:
fatalError in class AbstractLogger
Parameters:
message - the message to log.

fatalError

public void fatalError(java.lang.Object message,
                       java.lang.Throwable e)
Logs a message at the FATAL ERROR level including the stack trace of the Throwable thr passed as parameter.

Note: Some of PSDK supported logging frameworks (namely "Slf4J" and "java.util.logging") do not support FATAL ERROR messages level.
So, in Slf4J logging adapter PSDK marks such messages with "PSDK_FATAL_MESSAGE" marker.
And in java.util.logging adapter this level is processed as ERROR (SEVERE).

Specified by:
fatalError in interface ILogger
Overrides:
fatalError in class AbstractLogger
Parameters:
message - the message object to log.
e - the exception to log, including its stack trace.

fatalError

public void fatalError(LmsMessageTemplate key,
                       java.lang.Object... args)
Logs localized LMS event as a fatal error message.

Note: "Fatal error" level of this method does not affect LMS events level (LmsMessageTemplate.getLevel()) logged with this method.
LmsEventLogger applies LMS localization and pass this call to actual underlying log system as ".fatal(...)" method call.
So, common logging functionality will have these events as "fatal", but in case of Message Server appender, or Log4j2 GLmsLayout, there will be value of LmsMessageTemplate.getLevel().

Specified by:
fatalError in interface LmsEventLogger
Parameters:
key - the key used for localization.
args - optional arguments.

fatalError

public void fatalError(LogCategory category,
                       LmsMessageTemplate key,
                       java.lang.Object... args)
Logs localized LMS event as a fatal error message.

Note: "Fatal error" level of this method does not affect LMS events level (LmsMessageTemplate.getLevel()) logged with this method.
LmsEventLogger applies LMS localization and pass this call to actual underlying log system as ".fatal(...)" method call.
So, common logging functionality will have these events as "fatal", but in case of Message Server appender, or Log4j2 GLmsLayout, there will be value of LmsMessageTemplate.getLevel().

Specified by:
fatalError in interface LmsEventLogger
Parameters:
category - the log event category.
key - the key used for localization.
args - optional arguments.

fatal

public void fatal(LmsMessageTemplate key,
                  java.lang.Object... args)
Logs localized LMS event as a fatal error message.

Note: "Fatal error" level of this method does not affect LMS events level (LmsMessageTemplate.getLevel()) logged with this method.
LmsEventLogger applies LMS localization and pass this call to actual underlying log system as ".fatal(...)" method call.
So, common logging functionality will have these events as "fatal", but in case of Message Server appender, or Log4j2 GLmsLayout, there will be value of LmsMessageTemplate.getLevel().

Specified by:
fatal in interface LmsEventLogger
Parameters:
key - the key used for localization.
args - optional arguments.

fatal

public void fatal(LogCategory category,
                  LmsMessageTemplate key,
                  java.lang.Object... args)
Logs localized LMS event as a fatal error message.

Note: "Fatal error" level of this method does not affect LMS events level (LmsMessageTemplate.getLevel()) logged with this method.
LmsEventLogger applies LMS localization and pass this call to actual underlying log system as ".fatal(...)" method call.
So, common logging functionality will have these events as "fatal", but in case of Message Server appender, or Log4j2 GLmsLayout, there will be value of LmsMessageTemplate.getLevel().

Specified by:
fatal in interface LmsEventLogger
Parameters:
category - the log event category.
key - the key used for localization.
args - optional arguments.

fatal

public void fatal(java.lang.String message,
                  java.lang.Object... args)
Logs a message at the FATAL ERROR level.
To format log messages PSDK uses MessageFormat class.
Quick examples on the rules of formatting:
 log.fatal("Value is ''{0}''", 1);
 log.fatal("Value for index: [{0}] = {1}", ind, val);

Note: Some of PSDK supported logging frameworks (namely "Slf4J" and "java.util.logging") do not support FATAL ERROR messages level.
So, in Slf4J logging adapter PSDK marks such messages with "PSDK_FATAL_MESSAGE" marker.
In java.util.logging adapter this level is processed as ERROR (SEVERE).

Specified by:
fatal in interface ILoggerEx
Parameters:
message - the message to log.
args - parameters to the message.
See Also:
MessageFormat

error

public void error(java.lang.Object message)
Logs a message at the ERROR level.

Specified by:
error in interface ILogger
Overrides:
error in class AbstractLogger
Parameters:
message - the message object to log.

error

public void error(java.lang.Object message,
                  java.lang.Throwable e)
Logs a message at the ERROR level including the stack trace of the Throwable thr passed as parameter.

Specified by:
error in interface ILogger
Overrides:
error in class AbstractLogger
Parameters:
message - the message object to log.
e - the exception to log, including its stack trace.

error

public void error(LmsMessageTemplate key,
                  java.lang.Object... args)
Logs localized LMS event as an error message.

Note: "Error" level of this method does not affect LMS events level (LmsMessageTemplate.getLevel()) logged with this method.
LmsEventLogger applies LMS localization and pass this call to actual underlying log system as ".error(...)" method call.
So, common logging functionality will have these events as "error", but in case of Message Server appender, or Log4j2 GLmsLayout, there will be value of LmsMessageTemplate.getLevel().

Specified by:
error in interface LmsEventLogger
Parameters:
key - the key used for localization.
args - optional arguments.

error

public void error(LogCategory category,
                  LmsMessageTemplate key,
                  java.lang.Object... args)
Logs localized LMS event as an error message.

Note: "Error" level of this method does not affect LMS events level (LmsMessageTemplate.getLevel()) logged with this method.
LmsEventLogger applies LMS localization and pass this call to actual underlying log system as ".error(...)" method call.
So, common logging functionality will have these events as "error", but in case of Message Server appender, or Log4j2 GLmsLayout, there will be value of LmsMessageTemplate.getLevel().

Specified by:
error in interface LmsEventLogger
Parameters:
category - the log event category.
key - the key used for localization.
args - optional arguments.

error

public void error(java.lang.String message,
                  java.lang.Object... args)
Logs a message at the ERROR level.
To format log messages PSDK uses MessageFormat class.
Quick examples on the rules of formatting:
 log.error("Value is ''{0}''", 1);
 log.error("Value for index: [{0}] = {1}", ind, val);

Specified by:
error in interface ILoggerEx
Parameters:
message - the message to log.
args - parameters to the message.
See Also:
MessageFormat

warn

public void warn(java.lang.Object message)
Logs a message at the WARNING level.

Specified by:
warn in interface ILogger
Overrides:
warn in class AbstractLogger
Parameters:
message - the message object to log.

warn

public void warn(java.lang.Object message,
                 java.lang.Throwable e)
Logs a message at the WARNING level including the stack trace of the Throwable thr passed as parameter.

Specified by:
warn in interface ILogger
Overrides:
warn in class AbstractLogger
Parameters:
message - the message object to log.
e - the exception to log, including its stack trace.

warn

public void warn(LmsMessageTemplate key,
                 java.lang.Object... args)
Logs localized LMS event as a warning message.

Note: "Warn" level of this method does not affect LMS events level (LmsMessageTemplate.getLevel()) logged with this method.
LmsEventLogger applies LMS localization and pass this call to actual underlying log system as ".warn(...)" method call.
So, common logging functionality will have these events as "warn", but in case of Message Server appender, or Log4j2 GLmsLayout, there will be value of LmsMessageTemplate.getLevel().

Specified by:
warn in interface LmsEventLogger
Parameters:
key - the key used for localization.
args - optional arguments.

warn

public void warn(LogCategory category,
                 LmsMessageTemplate key,
                 java.lang.Object... args)
Logs localized LMS event as a warning message.

Note: "Warn" level of this method does not affect LMS events level (LmsMessageTemplate.getLevel()) logged with this method.
LmsEventLogger applies LMS localization and pass this call to actual underlying log system as ".warn(...)" method call.
So, common logging functionality will have these events as "warn", but in case of Message Server appender, or Log4j2 GLmsLayout, there will be value of LmsMessageTemplate.getLevel().

Specified by:
warn in interface LmsEventLogger
Parameters:
category - the log event category.
key - the key used for localization.
args - optional arguments.

warn

public void warn(java.lang.String message,
                 java.lang.Object... args)
Logs a message at the WARNING level.
To format log messages PSDK uses MessageFormat class.
Quick examples on the rules of formatting:
 log.warn("Value is ''{0}''", 1);
 log.warn("Value for index: [{0}] = {1}", ind, val);

Specified by:
warn in interface ILoggerEx
Parameters:
message - the message to log.
args - parameters to the message.
See Also:
MessageFormat

info

public void info(java.lang.Object message)
Logs a message at the INFO level.

Specified by:
info in interface ILogger
Overrides:
info in class AbstractLogger
Parameters:
message - the message object to log.

info

public void info(java.lang.Object message,
                 java.lang.Throwable e)
Logs a message at the INFO level including the stack trace of the Throwable thr passed as parameter.

Specified by:
info in interface ILogger
Overrides:
info in class AbstractLogger
Parameters:
message - the message object to log.
e - the exception to log, including its stack trace.

info

public void info(LmsMessageTemplate key,
                 java.lang.Object... args)
Logs localized LMS event as an info message.

Note: "Info" level of this method does not affect LMS events level (LmsMessageTemplate.getLevel()) logged with this method.
LmsEventLogger applies LMS localization and pass this call to actual underlying log system as ".info(...)" method call.
So, common logging functionality will have these events as "info", but in case of Message Server appender, or Log4j2 GLmsLayout, there will be value of LmsMessageTemplate.getLevel().

Specified by:
info in interface LmsEventLogger
Parameters:
key - the key used for localization.
args - optional arguments.

info

public void info(LogCategory category,
                 LmsMessageTemplate key,
                 java.lang.Object... args)
Logs localized LMS event as an info message.

Note: "Info" level of this method does not affect LMS events level (LmsMessageTemplate.getLevel()) logged with this method.
LmsEventLogger applies LMS localization and pass this call to actual underlying log system as ".info(...)" method call.
So, common logging functionality will have these events as "info", but in case of Message Server appender, or Log4j2 GLmsLayout, there will be value of LmsMessageTemplate.getLevel().

Specified by:
info in interface LmsEventLogger
Parameters:
category - the log event category.
key - the key used for localization.
args - optional arguments.

info

public void info(java.lang.String message,
                 java.lang.Object... args)
Logs a message at the INFO level.
To format log messages PSDK uses MessageFormat class.
Quick examples on the rules of formatting:
 log.info("Value is ''{0}''", 1);
 log.info("Value for index: [{0}] = {1}", ind, val);

Specified by:
info in interface ILoggerEx
Parameters:
message - the message to log.
args - parameters to the message.
See Also:
MessageFormat

debug

public void debug(java.lang.Object message)
Logs a message at the DEBUG level.

Specified by:
debug in interface ILogger
Overrides:
debug in class AbstractLogger
Parameters:
message - the message object to log.

debug

public void debug(java.lang.Object message,
                  java.lang.Throwable e)
Logs a message at the DEBUG level including the stack trace of the Throwable thr passed as parameter.

Specified by:
debug in interface ILogger
Overrides:
debug in class AbstractLogger
Parameters:
message - the message object to log.
e - the exception to log, including its stack trace.

debug

public void debug(LmsMessageTemplate key,
                  java.lang.Object... args)
Logs localized LMS event as a debug message.

Note: "Debug" level of this method does not affect LMS events level (LmsMessageTemplate.getLevel()) logged with this method.
LmsEventLogger applies LMS localization and pass this call to actual underlying log system as ".debug(...)" method call.
So, common logging functionality will have these events as "debug", but in case of Message Server appender, or Log4j2 GLmsLayout, there will be value of LmsMessageTemplate.getLevel().

Specified by:
debug in interface LmsEventLogger
Parameters:
key - the key used for localization.
args - optional arguments.

debug

public void debug(LogCategory category,
                  LmsMessageTemplate key,
                  java.lang.Object... args)
Logs localized LMS event as a debug message.

Note: "Debug" level of this method does not affect LMS events level (LmsMessageTemplate.getLevel()) logged with this method.
LmsEventLogger applies LMS localization and pass this call to actual underlying log system as ".debug(...)" method call.
So, common logging functionality will have these events as "debug", but in case of Message Server appender, or Log4j2 GLmsLayout, there will be value of LmsMessageTemplate.getLevel().

Specified by:
debug in interface LmsEventLogger
Parameters:
category - the log event category.
key - the key used for localization.
args - optional arguments.

debug

public void debug(java.lang.String message,
                  java.lang.Object... args)
Logs formatted debug message with optional arguments. To format log messages PSDK uses MessageFormat class.
Quick examples on the rules of formatting:
 log.debug("Value is ''{0}''", 1);
 log.debug("Value for index: [{0}] = {1}", ind, val);

Specified by:
debug in interface ILoggerEx
Parameters:
message - message with format tags
args - arguments for format
See Also:
MessageFormat

trace

public void trace(java.lang.String message,
                  java.lang.Object... args)
Logs formatted trace message with optional arguments. To format log messages PSDK uses MessageFormat class.
Quick examples on the rules of formatting:
 log.trace("Value is ''{0}''", 1);
 log.trace("Value for index: [{0}] = {1}", ind, val);

Specified by:
trace in interface ILoggerEx
Parameters:
message - message with format tags
args - arguments for format
See Also:
MessageFormat

doLogEvent

protected abstract void doLogEvent(LogCategory category,
                                   AbstractLogger.Level logLevel,
                                   LmsMessageTemplate key,
                                   java.lang.Object... args)
Logs a localized message.
Specific LmsEventLogger class should implement this method to process log messages.

Parameters:
category - the log event category.
logLevel - the PSDK log level value.
key - the key used for localization.
args - optional arguments.

getThrowableArg

protected static java.lang.Throwable getThrowableArg(java.lang.Object... args)
Returns the last argument value as Throwable.

Parameters:
args - arguments of a log request.
Returns:
the last argument if it is Throwable, or null.

Platform SDK Java 8.5 API Reference

Send comments on this topicTechpubs.webadmin@genesys.com.
Document version: 8.5.302.00
Copyright © 2006–2017 Genesys Telecommunications Laboratories, Inc. All rights reserved.