- java.lang.Object
-
- org.refcodes.logger.RuntimeLoggerImpl
-
- All Implemented Interfaces:
LogDecorator,LoggerAccessor<Logger<Object>>,LoggerAccessor.LoggerMutator<Logger<Object>>,LoggerAccessor.LoggerProperty<Logger<Object>>,LogPriorityAccessor,LogPriorityAccessor.LogPriorityMutator,LogPriorityAccessor.LogPriorityProperty,MessageLogger<LogPriority>,RuntimeLogger,org.refcodes.mixin.NameAccessor,org.refcodes.mixin.NameAccessor.NameMutator,org.refcodes.mixin.NameAccessor.NameProperty
public class RuntimeLoggerImpl extends Object implements RuntimeLogger, LoggerAccessor.LoggerProperty<Logger<Object>>, org.refcodes.mixin.NameAccessor.NameProperty, LogPriorityAccessor.LogPriorityProperty
The default implementation of theRuntimeLoggerinterface to be configured with a (back-end)Logger. In case no (back-end)Loggerhas been set viasetLogger(Logger)then the plainSystemLoggerwill be used as fallback.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.refcodes.logger.LoggerAccessor
LoggerAccessor.LoggerMutator<L extends Logger<?>>, LoggerAccessor.LoggerProperty<L extends Logger<?>>
-
Nested classes/interfaces inherited from interface org.refcodes.logger.LogPriorityAccessor
LogPriorityAccessor.LogPriorityMutator, LogPriorityAccessor.LogPriorityProperty
-
-
Field Summary
Fields Modifier and Type Field Description static LogPriorityDEFAULT_LOG_PRIORITYstatic StringROOT_LOGGER_NAME-
Fields inherited from interface org.refcodes.logger.RuntimeLogger
ROOT_LOGGER_ELEMENT_PATH, RUNTIME_LOGGER_CONFIG
-
-
Constructor Summary
Constructors Constructor Description RuntimeLoggerImpl()Constructs aRuntimeLoggerlogging with the givenLoggerand the desiredLogPriorityfor the messages being logged and upwards (from the givenLogPriority.getPriority()and higher).RuntimeLoggerImpl(String aName, Logger<Object> aLogger)Constructs aRuntimeLoggerlogging with the givenLoggerand the desiredLogPriorityfor the messages being logged and upwards (from the givenLogPriority.getPriority()and higher).RuntimeLoggerImpl(String aName, Logger<Object> aLogger, LogPriority aPriority)Constructs aRuntimeLoggerlogging with the givenLoggerand the desiredLogPriorityfor the messages being logged and upwards (from the givenLogPriority.getPriority()and higher).RuntimeLoggerImpl(Logger<Object> aLogger)Constructs aRuntimeLoggerlogging with the givenLoggerand the desiredLogPriorityfor the messages being logged and upwards (from the givenLogPriority.getPriority()and higher).RuntimeLoggerImpl(Logger<Object> aLogger, LogPriority aPriority)Constructs aRuntimeLoggerlogging with the givenLoggerand the desiredLogPriorityfor the messages being logged and upwards (from the givenLogPriority.getPriority()and higher).
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidalert(String aMessage)Logs a log message with log priorityLogPriority.ALERT.voidalert(String aMessage, Object... aArguments)Logs a log message with log priorityLogPriority.ALERT.voidalert(String aMessage, Throwable aThrowable)Logs a log message with log priorityLogPriority.ALERT.voidalert(String aMessage, Throwable aThrowable, Object... aArguments)Logs a log message with log priorityLogPriority.ALERT.voidcritical(String aMessage)Logs a log message with log priorityLogPriority.CRITICAL.voidcritical(String aMessage, Object... aArguments)Logs a log message with log priorityLogPriority.CRITICAL.voidcritical(String aMessage, Throwable aThrowable)Logs a log message with log priorityLogPriority.CRITICAL.voidcritical(String aMessage, Throwable aThrowable, Object... aArguments)Logs a log message with log priorityLogPriority.CRITICAL.voiddebug(String aMessage)Logs a log message with log priorityLogPriority.DEBUG.voiddebug(String aMessage, Object... aArguments)Logs a log message with log priorityLogPriority.DEBUG.protected voiddoLog(LogPriority aPriority, String aMessage, StackTraceElement aStackTraceElement, Throwable aThrowable)Helper method to log the required information.voiderror(String aMessage)Logs a log message with log priorityLogPriority.ERROR.voiderror(String aMessage, Object... aArguments)Logs a log message with log priorityLogPriority.ERROR.voiderror(String aMessage, Throwable aThrowable)Logs a log message with log priorityLogPriority.ERROR.voiderror(String aMessage, Throwable aThrowable, Object... aArguments)Logs a log message with log priorityLogPriority.ERROR.static StackTraceElementgetCallerStackTraceElement()Returns the stack trace element belonging to the caller of the caller of this method.Logger<Object>getLogger()Retrieves the logger from the logger property.LogPrioritygetLogPriority()Retrieves theLogPriorityfrom theLogPriorityAccessor.StringgetName()voidinfo(String aMessage)Logs a log message with log priorityLogPriority.INFO.voidinfo(String aMessage, Object... aArguments)Logs a log message with log priorityLogPriority.INFO.booleanisLog(LogPriority aPriority)Determines whether theRuntimeLoggeris being configured to log messages of the accordingLogPriority.booleanisLogAlert()Determines whether theRuntimeLoggeris being configured to log fatal messages (LogPriority.ALERT).booleanisLogCritical()Determines whether theRuntimeLoggeris being configured to log fatal messages (LogPriority.CRITICAL).booleanisLogDebug()Determines whether theRuntimeLoggeris being configured to log debug messages (LogPriority.DEBUG).booleanisLogError()Determines whether theRuntimeLoggeris being configured to log errors (LogPriority.ERROR).booleanisLogInfo()Determines whether theRuntimeLoggeris being configured to log infos (LogPriority.INFO).booleanisLogNotice()Determines whether theRuntimeLoggeris being configured to log notices (LogPriority.NOTICE).booleanisLogPanic()Determines whether theRuntimeLoggeris being configured to log fatal messages (LogPriority.PANIC).booleanisLogTrace()Determines whether theRuntimeLoggeris being configured to log comments (LogPriority.TRACE).booleanisLogWarn()Determines whether theRuntimeLoggeris being configured to log warnings (LogPriority.WARN).voidlog(LogPriority aPriority, String aMessage)Creates a new log message.voidlog(LogPriority aPriority, String aMessage, Object... aArguments)Creates a new log message.voidlog(LogPriority aPriority, String aMessage, Throwable aThrowable)Creates a new log message.voidlog(LogPriority aPriority, String aMessage, Throwable aThrowable, Object... aArguments)Creates a new log message.voidnotice(String aMessage)Logs a log message with log priorityLogPriority.NOTICE.voidnotice(String aMessage, Object... aArguments)Logs a log message with log priorityLogPriority.NOTICE.voidpanic(String aMessage)Logs a log message with log priorityLogPriority.PANIC.voidpanic(String aMessage, Object... aArguments)Logs a log message with log priorityLogPriority.PANIC.voidpanic(String aMessage, Throwable aThrowable)Logs a log message with log priorityLogPriority.PANIC.voidpanic(String aMessage, Throwable aThrowable, Object... aArguments)Logs a log message with log priorityLogPriority.PANIC.voidprintHead()Prints the logger's head in case it hasn't been printed before orLogDecorator.printTail()has been called.voidprintSeparator()Prints a separator line in case the underlyingLoggersupports the such.voidprintTail()Prints the logger's tail in case it hasn't been printed before orLogDecorator.printHead()has been called.voidsetLogger(Logger<Object> aLogger)Sets the logger for the logger property.voidsetLogLevel(String aLogLevel)Similar tosetLogPriority(LogPriority)with the difference, that aStringis passed instead of aLogPriorityelement.voidsetLogPriority(LogPriority aLogPriority)Sets theLogPriorityfor theLogPriorityAccessor.voidsetName(String aName)Propagate the name where possible to the underlying logger.voidtrace(String aMessage)Logs a log message with log priorityLogPriority.TRACE.voidtrace(String aMessage, Object... aArguments)Logs a log message with log priorityLogPriority.TRACE.voidwarn(String aMessage)Logs a log message with log priorityLogPriority.WARN.voidwarn(String aMessage, Object... aArguments)Logs a log message with log priorityLogPriority.WARN.voidwarn(String aMessage, Throwable aThrowable)Logs a log message with log priorityLogPriority.WARN.voidwarn(String aMessage, Throwable aThrowable, Object... aArguments)Logs a log message with log priorityLogPriority.WARN.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.refcodes.logger.LoggerAccessor.LoggerProperty
letLogger
-
Methods inherited from interface org.refcodes.logger.LogPriorityAccessor.LogPriorityProperty
letLogPriority
-
-
-
-
Field Detail
-
ROOT_LOGGER_NAME
public static final String ROOT_LOGGER_NAME
- See Also:
- Constant Field Values
-
DEFAULT_LOG_PRIORITY
public static final LogPriority DEFAULT_LOG_PRIORITY
-
-
Constructor Detail
-
RuntimeLoggerImpl
public RuntimeLoggerImpl(String aName, Logger<Object> aLogger, LogPriority aPriority)
Constructs aRuntimeLoggerlogging with the givenLoggerand the desiredLogPriorityfor the messages being logged and upwards (from the givenLogPriority.getPriority()and higher).- Parameters:
aName- the nameaLogger- The logger used for logging the runtime logs.aPriority- TheLogPriorityspecifying which log messages are to be logged. Any log message with aLogPriorityas the given one or higher (regarding theLogPriority.getPriority()value) is being logged.
-
RuntimeLoggerImpl
public RuntimeLoggerImpl(String aName, Logger<Object> aLogger)
Constructs aRuntimeLoggerlogging with the givenLoggerand the desiredLogPriorityfor the messages being logged and upwards (from the givenLogPriority.getPriority()and higher).- Parameters:
aName- the nameaLogger- The logger used for logging the runtime logs.
-
RuntimeLoggerImpl
public RuntimeLoggerImpl(Logger<Object> aLogger, LogPriority aPriority)
Constructs aRuntimeLoggerlogging with the givenLoggerand the desiredLogPriorityfor the messages being logged and upwards (from the givenLogPriority.getPriority()and higher).- Parameters:
aLogger- The logger used for logging the runtime logs.aPriority- TheLogPriorityspecifying which log messages are to be logged. Any log message with aLogPriorityas the given one or higher (regarding theLogPriority.getPriority()value) is being logged.
-
RuntimeLoggerImpl
public RuntimeLoggerImpl(Logger<Object> aLogger)
Constructs aRuntimeLoggerlogging with the givenLoggerand the desiredLogPriorityfor the messages being logged and upwards (from the givenLogPriority.getPriority()and higher).- Parameters:
aLogger- The logger used for logging the runtime logs.
-
RuntimeLoggerImpl
public RuntimeLoggerImpl()
Constructs aRuntimeLoggerlogging with the givenLoggerand the desiredLogPriorityfor the messages being logged and upwards (from the givenLogPriority.getPriority()and higher).
-
-
Method Detail
-
log
public void log(LogPriority aPriority, String aMessage)
Creates a new log message.- Specified by:
login interfaceMessageLogger<LogPriority>- Parameters:
aPriority- The marker for the message.aMessage- The message to be logged.
-
log
public void log(LogPriority aPriority, String aMessage, Throwable aThrowable)
Creates a new log message.- Specified by:
login interfaceRuntimeLogger- Parameters:
aPriority- The level of the message.aMessage- The message to be logged.aThrowable- An exception that the message should contain.
-
isLog
public boolean isLog(LogPriority aPriority)
Determines whether theRuntimeLoggeris being configured to log messages of the accordingLogPriority. This method is useful to prevent the generation of vast amounts of log messageStringobjects (and according processing) for the accordingLogPriorityin case them messages of thatLogPriorityare not logged at all.- Specified by:
isLogin interfaceRuntimeLogger- Parameters:
aPriority- TheLogPriorityto test whether theRuntimeLoggerdoes log messages of thatLogPriority.- Returns:
- True in case the
RuntimeLoggerdoes log messages of thatLogPriority.
-
getLogPriority
public LogPriority getLogPriority()
Retrieves theLogPriorityfrom theLogPriorityAccessor.- Specified by:
getLogPriorityin interfaceLogPriorityAccessor- Returns:
- The
LogPrioritystored by theLogPriorityAccessor.
-
trace
public void trace(String aMessage)
Logs a log message with log priorityLogPriority.TRACE.- Specified by:
tracein interfaceRuntimeLogger- Parameters:
aMessage- The message to be logged.
-
isLogTrace
public boolean isLogTrace()
Determines whether theRuntimeLoggeris being configured to log comments (LogPriority.TRACE). This method is useful to prevent the generation of vast amounts of log messageStringobjects (and according processing) for the accordingLogPriorityin case them messages of thatLogPriorityare not logged at all.- Specified by:
isLogTracein interfaceRuntimeLogger- Returns:
- True in case comments are logged.
-
debug
public void debug(String aMessage)
Logs a log message with log priorityLogPriority.DEBUG. "Info useful to developers for debugging the application, not useful during operations." See also http://en.wikipedia.org/wiki/Syslog- Specified by:
debugin interfaceRuntimeLogger- Parameters:
aMessage- The message to be logged.
-
isLogDebug
public boolean isLogDebug()
Determines whether theRuntimeLoggeris being configured to log debug messages (LogPriority.DEBUG). This method is useful to prevent the generation of vast amounts of log messageStringobjects (and according processing) for the accordingLogPriorityin case them messages of thatLogPriorityare not logged at all.- Specified by:
isLogDebugin interfaceRuntimeLogger- Returns:
- True in case debug messages are logged.
-
info
public void info(String aMessage)
Logs a log message with log priorityLogPriority.INFO. "Additional information which might be useful for some stability period." See also http://en.wikipedia.org/wiki/Syslog- Specified by:
infoin interfaceRuntimeLogger- Parameters:
aMessage- The message to be logged.
-
isLogInfo
public boolean isLogInfo()
Determines whether theRuntimeLoggeris being configured to log infos (LogPriority.INFO). This method is useful to prevent the generation of vast amounts of log messageStringobjects (and according processing) for the accordingLogPriorityin case them messages of thatLogPriorityare not logged at all.- Specified by:
isLogInfoin interfaceRuntimeLogger- Returns:
- True in case infos are logged.
-
notice
public void notice(String aMessage)
Logs a log message with log priorityLogPriority.NOTICE. "Events that are unusual but not error conditions - might be summarized in an email to developers or admins to spot potential problems - no immediate action required." See also http://en.wikipedia.org/wiki/Syslog- Specified by:
noticein interfaceRuntimeLogger- Parameters:
aMessage- The message to be logged.
-
isLogNotice
public boolean isLogNotice()
Determines whether theRuntimeLoggeris being configured to log notices (LogPriority.NOTICE). This method is useful to prevent the generation of vast amounts of log messageStringobjects (and according processing) for the accordingLogPriorityin case them messages of thatLogPriorityare not logged at all.- Specified by:
isLogNoticein interfaceRuntimeLogger- Returns:
- True in case infos are logged.
-
warn
public void warn(String aMessage)
Logs a log message with log priorityLogPriority.WARN. "Warning messages, not an error, but indication that an error will occur if action is not taken, e.g. file system 85% full - each item must be resolved within a given time." See also http://en.wikipedia.org/wiki/Syslog- Specified by:
warnin interfaceRuntimeLogger- Parameters:
aMessage- The message to be logged.
-
warn
public void warn(String aMessage, Throwable aThrowable)
Logs a log message with log priorityLogPriority.WARN. "Warning messages, not an error, but indication that an error will occur if action is not taken, e.g. file system 85% full - each item must be resolved within a given time." See also http://en.wikipedia.org/wiki/Syslog- Specified by:
warnin interfaceRuntimeLogger- Parameters:
aMessage- The message to be logged.aThrowable- An exception that the message should contain.
-
isLogWarn
public boolean isLogWarn()
Determines whether theRuntimeLoggeris being configured to log warnings (LogPriority.WARN). This method is useful to prevent the generation of vast amounts of log messageStringobjects (and according processing) for the accordingLogPriorityin case them messages of thatLogPriorityare not logged at all.- Specified by:
isLogWarnin interfaceRuntimeLogger- Returns:
- True in case warnings are logged.
-
error
public void error(String aMessage)
Logs a log message with log priorityLogPriority.ERROR. "Non-urgent failures, these should be relayed to developers or admins; each item must be resolved within a given time." See also http://en.wikipedia.org/wiki/Syslog- Specified by:
errorin interfaceRuntimeLogger- Parameters:
aMessage- The message to be logged.
-
error
public void error(String aMessage, Throwable aThrowable)
Logs a log message with log priorityLogPriority.ERROR. "Non-urgent failures, these should be relayed to developers or admins; each item must be resolved within a given time." See also http://en.wikipedia.org/wiki/Syslog- Specified by:
errorin interfaceRuntimeLogger- Parameters:
aMessage- The message to be logged.aThrowable- An exception that the message should contain.
-
isLogError
public boolean isLogError()
Determines whether theRuntimeLoggeris being configured to log errors (LogPriority.ERROR). This method is useful to prevent the generation of vast amounts of log messageStringobjects (and according processing) for the accordingLogPriorityin case them messages of thatLogPriorityare not logged at all.- Specified by:
isLogErrorin interfaceRuntimeLogger- Returns:
- True in case errors are logged.
-
critical
public void critical(String aMessage)
Logs a log message with log priorityLogPriority.CRITICAL. "Should be corrected immediately, but indicates failure in a secondary system, an example is a loss of a backup ISP connection." See also http://en.wikipedia.org/wiki/Syslog- Specified by:
criticalin interfaceRuntimeLogger- Parameters:
aMessage- The message to be logged.
-
critical
public void critical(String aMessage, Throwable aThrowable)
Logs a log message with log priorityLogPriority.CRITICAL. "Should be corrected immediately, but indicates failure in a secondary system, an example is a loss of a backup ISP connection." See also http://en.wikipedia.org/wiki/Syslog- Specified by:
criticalin interfaceRuntimeLogger- Parameters:
aMessage- The message to be logged.aThrowable- An exception that the message should contain.
-
isLogCritical
public boolean isLogCritical()
Determines whether theRuntimeLoggeris being configured to log fatal messages (LogPriority.CRITICAL). This method is useful to prevent the generation of vast amounts of log messageStringobjects (and according processing) for the accordingLogPriorityin case them messages of thatLogPriorityare not logged at all.- Specified by:
isLogCriticalin interfaceRuntimeLogger- Returns:
- True in case fatal messages are logged.
-
alert
public void alert(String aMessage)
Logs a log message with log priorityLogPriority.ALERT. "Should be corrected immediately, therefore notify staff who can fix the problem. An example would be the loss of a primary ISP connection." See also http://en.wikipedia.org/wiki/Syslog- Specified by:
alertin interfaceRuntimeLogger- Parameters:
aMessage- The message to be logged.
-
alert
public void alert(String aMessage, Throwable aThrowable)
Logs a log message with log priorityLogPriority.ALERT.- Specified by:
alertin interfaceRuntimeLogger- Parameters:
aMessage- The message to be logged.aThrowable- An exception that the message should contain.
-
isLogAlert
public boolean isLogAlert()
Determines whether theRuntimeLoggeris being configured to log fatal messages (LogPriority.ALERT). This method is useful to prevent the generation of vast amounts of log messageStringobjects (and according processing) for the accordingLogPriorityin case them messages of thatLogPriorityare not logged at all.- Specified by:
isLogAlertin interfaceRuntimeLogger- Returns:
- True in case fatal messages are logged.
-
panic
public void panic(String aMessage)
Logs a log message with log priorityLogPriority.PANIC. "A "panic" condition usually affecting multiple apps/servers/sites. At this level it would usually notify all tech staff on call." ( See also http://en.wikipedia.org/wiki/Syslog- Specified by:
panicin interfaceRuntimeLogger- Parameters:
aMessage- The message to be logged.
-
panic
public void panic(String aMessage, Throwable aThrowable)
Logs a log message with log priorityLogPriority.PANIC. "A "panic" condition usually affecting multiple apps/servers/sites. At this level it would usually notify all tech staff on call." ( See also http://en.wikipedia.org/wiki/Syslog- Specified by:
panicin interfaceRuntimeLogger- Parameters:
aMessage- The message to be logged.aThrowable- An exception that the message should contain.
-
isLogPanic
public boolean isLogPanic()
Determines whether theRuntimeLoggeris being configured to log fatal messages (LogPriority.PANIC). This method is useful to prevent the generation of vast amounts of log messageStringobjects (and according processing) for the accordingLogPriorityin case them messages of thatLogPriorityare not logged at all.- Specified by:
isLogPanicin interfaceRuntimeLogger- Returns:
- True in case fatal messages are logged.
-
log
public void log(LogPriority aPriority, String aMessage, Object... aArguments)
Creates a new log message. The placeholders in the messageStringare being replaced by the provided arguments. Implementations of this interface are recommended to use Java'sMessageFormat's syntax, the placeholder being replaced by the first argument is identified by "{0}" (without the quotes), the second one by "{1}", the third one by "{3}" and so on: Given the message to be "{0} + {1} = {2}" and the three argument be x, y and x + y, then "{0}" is replaced by the value of x, "{1}" is replaced by the value of y and "{2}" is replaced by the value of x + y.- Specified by:
login interfaceMessageLogger<LogPriority>- Parameters:
aPriority- The marker for the message.aMessage- The message to be logged.aArguments- The arguments used when replacing the placeholders.
-
log
public void log(LogPriority aPriority, String aMessage, Throwable aThrowable, Object... aArguments)
Creates a new log message. The placeholders in the messageStringare being replaced by the provided arguments. Implementations of this interface are recommended to use Java'sMessageFormat's syntax, the placeholder being replaced by the first argument is identified by "{0}" (without the quotes), the second one by "{1}", the third one by "{3}" and so on: Given the message to be "{0} + {1} = {2}" and the three argument be x, y and x + y, then "{0}" is replaced by the value of x, "{1}" is replaced by the value of y and "{2}" is replaced by the value of x + y.- Specified by:
login interfaceRuntimeLogger- Parameters:
aPriority- The level of the message.aMessage- The message to be logged.aThrowable- An exception that the message should contain.aArguments- The arguments used when replacing the placeholders.
-
trace
public void trace(String aMessage, Object... aArguments)
Logs a log message with log priorityLogPriority.TRACE. The placeholders in the messageStringare being replaced by the provided arguments. Implementations of this interface are recommended to use Java'sMessageFormat's syntax, the placeholder being replaced by the first argument is identified by "{0}" (without the quotes), the second one by "{1}", the third one by "{3}" and so on: Given the message to be "{0} + {1} = {2}" and the three argument be x, y and x + y, then "{0}" is replaced by the value of x, "{1}" is replaced by the value of y and "{2}" is replaced by the value of x + y.- Specified by:
tracein interfaceRuntimeLogger- Parameters:
aMessage- The message to be logged.aArguments- The arguments used when replacing the placeholders.
-
debug
public void debug(String aMessage, Object... aArguments)
Logs a log message with log priorityLogPriority.DEBUG. "Info useful to developers for debugging the application, not useful during operations." The placeholders in the messageStringare being replaced by the provided arguments. Implementations of this interface are recommended to use Java'sMessageFormat's syntax, the placeholder being replaced by the first argument is identified by "{0}" (without the quotes), the second one by "{1}", the third one by "{3}" and so on: Given the message to be "{0} + {1} = {2}" and the three argument be x, y and x + y, then "{0}" is replaced by the value of x, "{1}" is replaced by the value of y and "{2}" is replaced by the value of x + y. See also http://en.wikipedia.org/wiki/Syslog- Specified by:
debugin interfaceRuntimeLogger- Parameters:
aMessage- The message to be logged.aArguments- The arguments used when replacing the placeholders.
-
info
public void info(String aMessage, Object... aArguments)
Logs a log message with log priorityLogPriority.INFO. "Additional information which might be useful for some stability period." The placeholders in the messageStringare being replaced by the provided arguments. Implementations of this interface are recommended to use Java'sMessageFormat's syntax, the placeholder being replaced by the first argument is identified by "{0}" (without the quotes), the second one by "{1}", the third one by "{3}" and so on: Given the message to be "{0} + {1} = {2}" and the three argument be x, y and x + y, then "{0}" is replaced by the value of x, "{1}" is replaced by the value of y and "{2}" is replaced by the value of x + y. See also http://en.wikipedia.org/wiki/Syslog- Specified by:
infoin interfaceRuntimeLogger- Parameters:
aMessage- The message to be logged.aArguments- The arguments used when replacing the placeholders.
-
notice
public void notice(String aMessage, Object... aArguments)
Logs a log message with log priorityLogPriority.NOTICE. "Events that are unusual but not error conditions - might be summarized in an email to developers or admins to spot potential problems - no immediate action required." The placeholders in the messageStringare being replaced by the provided arguments. Implementations of this interface are recommended to use Java'sMessageFormat's syntax, the placeholder being replaced by the first argument is identified by "{0}" (without the quotes), the second one by "{1}", the third one by "{3}" and so on: Given the message to be "{0} + {1} = {2}" and the three argument be x, y and x + y, then "{0}" is replaced by the value of x, "{1}" is replaced by the value of y and "{2}" is replaced by the value of x + y. See also http://en.wikipedia.org/wiki/Syslog- Specified by:
noticein interfaceRuntimeLogger- Parameters:
aMessage- The message to be logged.aArguments- The arguments used when replacing the placeholders.
-
warn
public void warn(String aMessage, Object... aArguments)
Logs a log message with log priorityLogPriority.WARN. "Warning messages, not an error, but indication that an error will occur if action is not taken, e.g. file system 85% full - each item must be resolved within a given time." The placeholders in the messageStringare being replaced by the provided arguments. Implementations of this interface are recommended to use Java'sMessageFormat's syntax, the placeholder being replaced by the first argument is identified by "{0}" (without the quotes), the second one by "{1}", the third one by "{3}" and so on: Given the message to be "{0} + {1} = {2}" and the three argument be x, y and x + y, then "{0}" is replaced by the value of x, "{1}" is replaced by the value of y and "{2}" is replaced by the value of x + y. See also http://en.wikipedia.org/wiki/Syslog- Specified by:
warnin interfaceRuntimeLogger- Parameters:
aMessage- The message to be logged.aArguments- The arguments used when replacing the placeholders.
-
warn
public void warn(String aMessage, Throwable aThrowable, Object... aArguments)
Logs a log message with log priorityLogPriority.WARN. "Warning messages, not an error, but indication that an error will occur if action is not taken, e.g. file system 85% full - each item must be resolved within a given time." The placeholders in the messageStringare being replaced by the provided arguments. Implementations of this interface are recommended to use Java'sMessageFormat's syntax, the placeholder being replaced by the first argument is identified by "{0}" (without the quotes), the second one by "{1}", the third one by "{3}" and so on: Given the message to be "{0} + {1} = {2}" and the three argument be x, y and x + y, then "{0}" is replaced by the value of x, "{1}" is replaced by the value of y and "{2}" is replaced by the value of x + y. See also http://en.wikipedia.org/wiki/Syslog- Specified by:
warnin interfaceRuntimeLogger- Parameters:
aMessage- The message to be logged.aThrowable- An exception that the message should contain.aArguments- The arguments used when replacing the placeholders.
-
error
public void error(String aMessage, Object... aArguments)
Logs a log message with log priorityLogPriority.ERROR. "Non-urgent failures, these should be relayed to developers or admins; each item must be resolved within a given time." The placeholders in the messageStringare being replaced by the provided arguments. Implementations of this interface are recommended to use Java'sMessageFormat's syntax, the placeholder being replaced by the first argument is identified by "{0}" (without the quotes), the second one by "{1}", the third one by "{3}" and so on: Given the message to be "{0} + {1} = {2}" and the three argument be x, y and x + y, then "{0}" is replaced by the value of x, "{1}" is replaced by the value of y and "{2}" is replaced by the value of x + y. See also http://en.wikipedia.org/wiki/Syslog- Specified by:
errorin interfaceRuntimeLogger- Parameters:
aMessage- The message to be logged.aArguments- The arguments used when replacing the placeholders.
-
error
public void error(String aMessage, Throwable aThrowable, Object... aArguments)
Logs a log message with log priorityLogPriority.ERROR. "Non-urgent failures, these should be relayed to developers or admins; each item must be resolved within a given time." The placeholders in the messageStringare being replaced by the provided arguments. Implementations of this interface are recommended to use Java'sMessageFormat's syntax, the placeholder being replaced by the first argument is identified by "{0}" (without the quotes), the second one by "{1}", the third one by "{3}" and so on: Given the message to be "{0} + {1} = {2}" and the three argument be x, y and x + y, then "{0}" is replaced by the value of x, "{1}" is replaced by the value of y and "{2}" is replaced by the value of x + y. See also http://en.wikipedia.org/wiki/Syslog- Specified by:
errorin interfaceRuntimeLogger- Parameters:
aMessage- The message to be logged.aThrowable- An exception that the message should contain.aArguments- The arguments used when replacing the placeholders.
-
critical
public void critical(String aMessage, Object... aArguments)
Logs a log message with log priorityLogPriority.CRITICAL. "Should be corrected immediately, but indicates failure in a secondary system, an example is a loss of a backup ISP connection." The placeholders in the messageStringare being replaced by the provided arguments. Implementations of this interface are recommended to use Java'sMessageFormat's syntax, the placeholder being replaced by the first argument is identified by "{0}" (without the quotes), the second one by "{1}", the third one by "{3}" and so on: Given the message to be "{0} + {1} = {2}" and the three argument be x, y and x + y, then "{0}" is replaced by the value of x, "{1}" is replaced by the value of y and "{2}" is replaced by the value of x + y. See also http://en.wikipedia.org/wiki/Syslog- Specified by:
criticalin interfaceRuntimeLogger- Parameters:
aMessage- The message to be logged.aArguments- The arguments used when replacing the placeholders.
-
critical
public void critical(String aMessage, Throwable aThrowable, Object... aArguments)
Logs a log message with log priorityLogPriority.CRITICAL. "Should be corrected immediately, but indicates failure in a secondary system, an example is a loss of a backup ISP connection." See also http://en.wikipedia.org/wiki/Syslog- Specified by:
criticalin interfaceRuntimeLogger- Parameters:
aMessage- The message to be logged.aThrowable- An exception that the message should contain.aArguments- The arguments used when replacing the placeholders.
-
alert
public void alert(String aMessage, Object... aArguments)
Logs a log message with log priorityLogPriority.ALERT. "Should be corrected immediately, therefore notify staff who can fix the problem. An example would be the loss of a primary ISP connection." The placeholders in the messageStringare being replaced by the provided arguments. Implementations of this interface are recommended to use Java'sMessageFormat's syntax, the placeholder being replaced by the first argument is identified by "{0}" (without the quotes), the second one by "{1}", the third one by "{3}" and so on: Given the message to be "{0} + {1} = {2}" and the three argument be x, y and x + y, then "{0}" is replaced by the value of x, "{1}" is replaced by the value of y and "{2}" is replaced by the value of x + y. See also http://en.wikipedia.org/wiki/Syslog- Specified by:
alertin interfaceRuntimeLogger- Parameters:
aMessage- The message to be logged.aArguments- The arguments used when replacing the placeholders.
-
alert
public void alert(String aMessage, Throwable aThrowable, Object... aArguments)
Logs a log message with log priorityLogPriority.ALERT.- Specified by:
alertin interfaceRuntimeLogger- Parameters:
aMessage- The message to be logged.aThrowable- An exception that the message should contain.aArguments- The arguments used when replacing the placeholders.
-
panic
public void panic(String aMessage, Object... aArguments)
Logs a log message with log priorityLogPriority.PANIC. "A "panic" condition usually affecting multiple apps/servers/sites. At this level it would usually notify all tech staff on call." The placeholders in the messageStringare being replaced by the provided arguments. Implementations of this interface are recommended to use Java'sMessageFormat's syntax, the placeholder being replaced by the first argument is identified by "{0}" (without the quotes), the second one by "{1}", the third one by "{3}" and so on: Given the message to be "{0} + {1} = {2}" and the three argument be x, y and x + y, then "{0}" is replaced by the value of x, "{1}" is replaced by the value of y and "{2}" is replaced by the value of x + y. See also http://en.wikipedia.org/wiki/Syslog- Specified by:
panicin interfaceRuntimeLogger- Parameters:
aMessage- The message to be logged.aArguments- The arguments used when replacing the placeholders.
-
panic
public void panic(String aMessage, Throwable aThrowable, Object... aArguments)
Logs a log message with log priorityLogPriority.PANIC. "A "panic" condition usually affecting multiple apps/servers/sites. At this level it would usually notify all tech staff on call." The placeholders in the messageStringare being replaced by the provided arguments. Implementations of this interface are recommended to use Java'sMessageFormat's syntax, the placeholder being replaced by the first argument is identified by "{0}" (without the quotes), the second one by "{1}", the third one by "{3}" and so on: Given the message to be "{0} + {1} = {2}" and the three argument be x, y and x + y, then "{0}" is replaced by the value of x, "{1}" is replaced by the value of y and "{2}" is replaced by the value of x + y. See also http://en.wikipedia.org/wiki/Syslog- Specified by:
panicin interfaceRuntimeLogger- Parameters:
aMessage- The message to be logged.aThrowable- An exception that the message should contain.aArguments- The arguments used when replacing the placeholders.
-
setLogger
public void setLogger(Logger<Object> aLogger)
Sets the logger for the logger property.- Specified by:
setLoggerin interfaceLoggerAccessor.LoggerMutator<Logger<Object>>- Parameters:
aLogger- The logger to be stored by the logger property.
-
setLogLevel
public void setLogLevel(String aLogLevel)
Similar tosetLogPriority(LogPriority)with the difference, that aStringis passed instead of aLogPriorityelement. TheStringvariant is required by the configuration framework as used by theRuntimeLoggerSingleton.- Parameters:
aLogLevel- TheStringrepresentation of the requiredLogPriority.
-
setLogPriority
public void setLogPriority(LogPriority aLogPriority)
Sets theLogPriorityfor theLogPriorityAccessor.- Specified by:
setLogPriorityin interfaceLogPriorityAccessor.LogPriorityMutator- Parameters:
aLogPriority- TheLogPriorityto be stored by theLogPriorityAccessor.
-
getName
public String getName()
- Specified by:
getNamein interfaceorg.refcodes.mixin.NameAccessor
-
setName
public void setName(String aName)
Propagate the name where possible to the underlying logger.- Specified by:
setNamein interfaceorg.refcodes.mixin.NameAccessor.NameMutator
-
printHead
public void printHead()
Prints the logger's head in case it hasn't been printed before orLogDecorator.printTail()has been called. Printing the head might result in printing out the additional logger's information such as the column names.- Specified by:
printHeadin interfaceLogDecorator
-
printSeparator
public void printSeparator()
Prints a separator line in case the underlyingLoggersupports the such. A separator line may be printed just as of beautifying purposes and does not belong to the actual log's data. Therefore this method may just do nothing, depending on the implementing class.- Specified by:
printSeparatorin interfaceLogDecorator
-
printTail
public void printTail()
Prints the logger's tail in case it hasn't been printed before orLogDecorator.printHead()has been called. Printing the tail might result in printing out the additional logger's information or visually finishing the current log sequence.- Specified by:
printTailin interfaceLogDecorator
-
getLogger
public Logger<Object> getLogger()
Retrieves the logger from the logger property.- Specified by:
getLoggerin interfaceLoggerAccessor<Logger<Object>>- Returns:
- The logger stored by the logger property.
-
doLog
protected void doLog(LogPriority aPriority, String aMessage, StackTraceElement aStackTraceElement, Throwable aThrowable)
Helper method to log the required information.- Parameters:
aPriority- the priorityaMessage- The message to be logged.aStackTraceElement- The stack trace element to be logged.aThrowable- TheExceptionto be logged.
-
getCallerStackTraceElement
public static StackTraceElement getCallerStackTraceElement()
Returns the stack trace element belonging to the caller of the caller of this method. When you use this method in your code, you get the stack trace element of the method calling your method.- Returns:
- The stack element of the caller of the caller of this method.
-
-