Package org.refcodes.logger
Class RuntimeLoggerImpl
- java.lang.Object
-
- org.refcodes.logger.RuntimeLoggerImpl
-
- All Implemented Interfaces:
LoggerAccessor.LoggerMutator<Logger<java.lang.Object>>
,LogPriorityAccessor
,LogPriorityAccessor.LogPriorityMutator
,MessageLogger<LogPriority>
,RuntimeLogger
,org.refcodes.mixin.NameAccessor
,org.refcodes.mixin.NameAccessor.NameMutator
public class RuntimeLoggerImpl extends java.lang.Object implements RuntimeLogger, LoggerAccessor.LoggerMutator<Logger<java.lang.Object>>, org.refcodes.mixin.NameAccessor.NameMutator, LogPriorityAccessor.LogPriorityMutator
The default implementation of theRuntimeLogger
interface to be configured with a (back-end)Logger
. In case no (back-end)Logger
has been set viasetLogger(Logger)
then the plainSystemLoggerImpl
will be used as fallback.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.refcodes.logger.LogPriorityAccessor
LogPriorityAccessor.LogPriorityMutator, LogPriorityAccessor.LogPriorityProperty
-
-
Field Summary
Fields Modifier and Type Field Description static LogPriority
DEFAULT_LOG_PRIORITY
static java.lang.String
ROOT_LOGGER_NAME
-
Fields inherited from interface org.refcodes.logger.RuntimeLogger
ROOT_LOGGER_ELEMENT_PATH, RUNTIME_LOGGER_CONFIG
-
-
Constructor Summary
Constructors Constructor Description RuntimeLoggerImpl()
Constructs aRuntimeLogger
logging with the givenLogger
and the desiredLogPriority
for the messages being logged and upwards (from the givenLogPriority.getPriority()
and higher).RuntimeLoggerImpl(java.lang.String aName, Logger<java.lang.Object> aLogger)
Constructs aRuntimeLogger
logging with the givenLogger
and the desiredLogPriority
for the messages being logged and upwards (from the givenLogPriority.getPriority()
and higher).RuntimeLoggerImpl(java.lang.String aName, Logger<java.lang.Object> aLogger, LogPriority aPriority)
Constructs aRuntimeLogger
logging with the givenLogger
and the desiredLogPriority
for the messages being logged and upwards (from the givenLogPriority.getPriority()
and higher).RuntimeLoggerImpl(Logger<java.lang.Object> aLogger)
Constructs aRuntimeLogger
logging with the givenLogger
and the desiredLogPriority
for the messages being logged and upwards (from the givenLogPriority.getPriority()
and higher).RuntimeLoggerImpl(Logger<java.lang.Object> aLogger, LogPriority aPriority)
Constructs aRuntimeLogger
logging with the givenLogger
and the desiredLogPriority
for 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 void
alert(java.lang.String aMessage)
Logs a log message with log priorityLogPriority.ALERT
.void
alert(java.lang.String aMessage, java.lang.Object... aArguments)
Logs a log message with log priorityLogPriority.ALERT
.void
alert(java.lang.String aMessage, java.lang.Throwable aThrowable)
Logs a log message with log priorityLogPriority.ALERT
.void
alert(java.lang.String aMessage, java.lang.Throwable aThrowable, java.lang.Object... aArguments)
Logs a log message with log priorityLogPriority.ALERT
.void
critical(java.lang.String aMessage)
Logs a log message with log priorityLogPriority.CRITICAL
.void
critical(java.lang.String aMessage, java.lang.Object... aArguments)
Logs a log message with log priorityLogPriority.CRITICAL
.void
critical(java.lang.String aMessage, java.lang.Throwable aThrowable)
Logs a log message with log priorityLogPriority.CRITICAL
.void
critical(java.lang.String aMessage, java.lang.Throwable aThrowable, java.lang.Object... aArguments)
Logs a log message with log priorityLogPriority.CRITICAL
.void
debug(java.lang.String aMessage)
Logs a log message with log priorityLogPriority.DEBUG
.void
debug(java.lang.String aMessage, java.lang.Object... aArguments)
Logs a log message with log priorityLogPriority.DEBUG
.protected void
doLog(LogPriority aPriority, java.lang.String aMessage, java.lang.StackTraceElement aStackTraceElement, java.lang.Throwable aThrowable)
Helper method to log the required information.void
error(java.lang.String aMessage)
Logs a log message with log priorityLogPriority.ERROR
.void
error(java.lang.String aMessage, java.lang.Object... aArguments)
Logs a log message with log priorityLogPriority.ERROR
.void
error(java.lang.String aMessage, java.lang.Throwable aThrowable)
Logs a log message with log priorityLogPriority.ERROR
.void
error(java.lang.String aMessage, java.lang.Throwable aThrowable, java.lang.Object... aArguments)
Logs a log message with log priorityLogPriority.ERROR
.static java.lang.StackTraceElement
getCallerStackTraceElement()
Returns the stack trace element belonging to the caller of the caller of this method.LogPriority
getLogPriority()
Retrieves theLogPriority
from theLogPriorityAccessor
.java.lang.String
getName()
void
info(java.lang.String aMessage)
Logs a log message with log priorityLogPriority.INFO
.void
info(java.lang.String aMessage, java.lang.Object... aArguments)
Logs a log message with log priorityLogPriority.INFO
.boolean
isLog(LogPriority aPriority)
Determines whether theRuntimeLogger
is being configured to log messages of the accordingLogPriority
.boolean
isLogAlert()
Determines whether theRuntimeLogger
is being configured to log fatal messages (LogPriority.ALERT
).boolean
isLogCritical()
Determines whether theRuntimeLogger
is being configured to log fatal messages (LogPriority.CRITICAL
).boolean
isLogDebug()
Determines whether theRuntimeLogger
is being configured to log debug messages (LogPriority.DEBUG
).boolean
isLogError()
Determines whether theRuntimeLogger
is being configured to log errors (LogPriority.ERROR
).boolean
isLogInfo()
Determines whether theRuntimeLogger
is being configured to log infos (LogPriority.INFO
).boolean
isLogNotice()
Determines whether theRuntimeLogger
is being configured to log notices (LogPriority.NOTICE
).boolean
isLogPanic()
Determines whether theRuntimeLogger
is being configured to log fatal messages (LogPriority.PANIC
).boolean
isLogTrace()
Determines whether theRuntimeLogger
is being configured to log comments (LogPriority.TRACE
).boolean
isLogWarn()
Determines whether theRuntimeLogger
is being configured to log warnings (LogPriority.WARN
).void
log(LogPriority aPriority, java.lang.String aMessage)
Creates a new log message.void
log(LogPriority aPriority, java.lang.String aMessage, java.lang.Object... aArguments)
Creates a new log message.void
log(LogPriority aPriority, java.lang.String aMessage, java.lang.Throwable aThrowable)
Creates a new log message.void
log(LogPriority aPriority, java.lang.String aMessage, java.lang.Throwable aThrowable, java.lang.Object... aArguments)
Creates a new log message.void
notice(java.lang.String aMessage)
Logs a log message with log priorityLogPriority.NOTICE
.void
notice(java.lang.String aMessage, java.lang.Object... aArguments)
Logs a log message with log priorityLogPriority.NOTICE
.void
panic(java.lang.String aMessage)
Logs a log message with log priorityLogPriority.PANIC
.void
panic(java.lang.String aMessage, java.lang.Object... aArguments)
Logs a log message with log priorityLogPriority.PANIC
.void
panic(java.lang.String aMessage, java.lang.Throwable aThrowable)
Logs a log message with log priorityLogPriority.PANIC
.void
panic(java.lang.String aMessage, java.lang.Throwable aThrowable, java.lang.Object... aArguments)
Logs a log message with log priorityLogPriority.PANIC
.void
printSeparator()
Prints a separator line in case the underlyingLogger
supports the such.void
setLogger(Logger<java.lang.Object> aLogger)
Sets the logger for the logger property.void
setLogLevel(java.lang.String aLogLevel)
Similar tosetLogPriority(LogPriority)
with the difference, that aString
is passed instead of aLogPriority
element.void
setLogPriority(LogPriority aLogPriority)
Sets theLogPriority
for theLogPriorityAccessor
.void
setName(java.lang.String aName)
void
trace(java.lang.String aMessage)
Logs a log message with log priorityLogPriority.TRACE
.void
trace(java.lang.String aMessage, java.lang.Object... aArguments)
Logs a log message with log priorityLogPriority.TRACE
.void
warn(java.lang.String aMessage)
Logs a log message with log priorityLogPriority.WARN
.void
warn(java.lang.String aMessage, java.lang.Object... aArguments)
Logs a log message with log priorityLogPriority.WARN
.void
warn(java.lang.String aMessage, java.lang.Throwable aThrowable)
Logs a log message with log priorityLogPriority.WARN
.void
warn(java.lang.String aMessage, java.lang.Throwable aThrowable, java.lang.Object... aArguments)
Logs a log message with log priorityLogPriority.WARN
.
-
-
-
Field Detail
-
ROOT_LOGGER_NAME
public static final java.lang.String ROOT_LOGGER_NAME
- See Also:
- Constant Field Values
-
DEFAULT_LOG_PRIORITY
public static final LogPriority DEFAULT_LOG_PRIORITY
-
-
Constructor Detail
-
RuntimeLoggerImpl
public RuntimeLoggerImpl(java.lang.String aName, Logger<java.lang.Object> aLogger, LogPriority aPriority)
Constructs aRuntimeLogger
logging with the givenLogger
and the desiredLogPriority
for 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
- TheLogPriority
specifying which log messages are to be logged. Any log message with aLogPriority
as the given one or higher (regarding theLogPriority.getPriority()
value) is being logged.
-
RuntimeLoggerImpl
public RuntimeLoggerImpl(java.lang.String aName, Logger<java.lang.Object> aLogger)
Constructs aRuntimeLogger
logging with the givenLogger
and the desiredLogPriority
for 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<java.lang.Object> aLogger, LogPriority aPriority)
Constructs aRuntimeLogger
logging with the givenLogger
and the desiredLogPriority
for the messages being logged and upwards (from the givenLogPriority.getPriority()
and higher).- Parameters:
aLogger
- The logger used for logging the runtime logs.aPriority
- TheLogPriority
specifying which log messages are to be logged. Any log message with aLogPriority
as the given one or higher (regarding theLogPriority.getPriority()
value) is being logged.
-
RuntimeLoggerImpl
public RuntimeLoggerImpl(Logger<java.lang.Object> aLogger)
Constructs aRuntimeLogger
logging with the givenLogger
and the desiredLogPriority
for 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 aRuntimeLogger
logging with the givenLogger
and the desiredLogPriority
for the messages being logged and upwards (from the givenLogPriority.getPriority()
and higher).
-
-
Method Detail
-
log
public void log(LogPriority aPriority, java.lang.String aMessage)
Creates a new log message.- Specified by:
log
in interfaceMessageLogger<LogPriority>
- Parameters:
aPriority
- The marker for the message.aMessage
- The message to be logged.
-
log
public void log(LogPriority aPriority, java.lang.String aMessage, java.lang.Throwable aThrowable)
Creates a new log message.- Specified by:
log
in 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 theRuntimeLogger
is being configured to log messages of the accordingLogPriority
. This method is useful to prevent the generation of vast amounts of log messageString
objects (and according processing) for the accordingLogPriority
in case them messages of thatLogPriority
are not logged at all.- Specified by:
isLog
in interfaceRuntimeLogger
- Parameters:
aPriority
- TheLogPriority
to test whether theRuntimeLogger
does log messages of thatLogPriority
.- Returns:
- True in case the
RuntimeLogger
does log messages of thatLogPriority
.
-
getLogPriority
public LogPriority getLogPriority()
Retrieves theLogPriority
from theLogPriorityAccessor
.- Specified by:
getLogPriority
in interfaceLogPriorityAccessor
- Returns:
- The
LogPriority
stored by theLogPriorityAccessor
.
-
trace
public void trace(java.lang.String aMessage)
Logs a log message with log priorityLogPriority.TRACE
.- Specified by:
trace
in interfaceRuntimeLogger
- Parameters:
aMessage
- The message to be logged.
-
isLogTrace
public boolean isLogTrace()
Determines whether theRuntimeLogger
is being configured to log comments (LogPriority.TRACE
). This method is useful to prevent the generation of vast amounts of log messageString
objects (and according processing) for the accordingLogPriority
in case them messages of thatLogPriority
are not logged at all.- Specified by:
isLogTrace
in interfaceRuntimeLogger
- Returns:
- True in case comments are logged.
-
debug
public void debug(java.lang.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:
debug
in interfaceRuntimeLogger
- Parameters:
aMessage
- The message to be logged.
-
isLogDebug
public boolean isLogDebug()
Determines whether theRuntimeLogger
is being configured to log debug messages (LogPriority.DEBUG
). This method is useful to prevent the generation of vast amounts of log messageString
objects (and according processing) for the accordingLogPriority
in case them messages of thatLogPriority
are not logged at all.- Specified by:
isLogDebug
in interfaceRuntimeLogger
- Returns:
- True in case debug messages are logged.
-
info
public void info(java.lang.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:
info
in interfaceRuntimeLogger
- Parameters:
aMessage
- The message to be logged.
-
isLogInfo
public boolean isLogInfo()
Determines whether theRuntimeLogger
is being configured to log infos (LogPriority.INFO
). This method is useful to prevent the generation of vast amounts of log messageString
objects (and according processing) for the accordingLogPriority
in case them messages of thatLogPriority
are not logged at all.- Specified by:
isLogInfo
in interfaceRuntimeLogger
- Returns:
- True in case infos are logged.
-
notice
public void notice(java.lang.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:
notice
in interfaceRuntimeLogger
- Parameters:
aMessage
- The message to be logged.
-
isLogNotice
public boolean isLogNotice()
Determines whether theRuntimeLogger
is being configured to log notices (LogPriority.NOTICE
). This method is useful to prevent the generation of vast amounts of log messageString
objects (and according processing) for the accordingLogPriority
in case them messages of thatLogPriority
are not logged at all.- Specified by:
isLogNotice
in interfaceRuntimeLogger
- Returns:
- True in case infos are logged.
-
warn
public void warn(java.lang.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:
warn
in interfaceRuntimeLogger
- Parameters:
aMessage
- The message to be logged.
-
warn
public void warn(java.lang.String aMessage, java.lang.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:
warn
in interfaceRuntimeLogger
- Parameters:
aMessage
- The message to be logged.aThrowable
- An exception that the message should contain.
-
isLogWarn
public boolean isLogWarn()
Determines whether theRuntimeLogger
is being configured to log warnings (LogPriority.WARN
). This method is useful to prevent the generation of vast amounts of log messageString
objects (and according processing) for the accordingLogPriority
in case them messages of thatLogPriority
are not logged at all.- Specified by:
isLogWarn
in interfaceRuntimeLogger
- Returns:
- True in case warnings are logged.
-
error
public void error(java.lang.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:
error
in interfaceRuntimeLogger
- Parameters:
aMessage
- The message to be logged.
-
error
public void error(java.lang.String aMessage, java.lang.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:
error
in interfaceRuntimeLogger
- Parameters:
aMessage
- The message to be logged.aThrowable
- An exception that the message should contain.
-
isLogError
public boolean isLogError()
Determines whether theRuntimeLogger
is being configured to log errors (LogPriority.ERROR
). This method is useful to prevent the generation of vast amounts of log messageString
objects (and according processing) for the accordingLogPriority
in case them messages of thatLogPriority
are not logged at all.- Specified by:
isLogError
in interfaceRuntimeLogger
- Returns:
- True in case errors are logged.
-
critical
public void critical(java.lang.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:
critical
in interfaceRuntimeLogger
- Parameters:
aMessage
- The message to be logged.
-
critical
public void critical(java.lang.String aMessage, java.lang.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:
critical
in interfaceRuntimeLogger
- Parameters:
aMessage
- The message to be logged.aThrowable
- An exception that the message should contain.
-
isLogCritical
public boolean isLogCritical()
Determines whether theRuntimeLogger
is being configured to log fatal messages (LogPriority.CRITICAL
). This method is useful to prevent the generation of vast amounts of log messageString
objects (and according processing) for the accordingLogPriority
in case them messages of thatLogPriority
are not logged at all.- Specified by:
isLogCritical
in interfaceRuntimeLogger
- Returns:
- True in case fatal messages are logged.
-
alert
public void alert(java.lang.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:
alert
in interfaceRuntimeLogger
- Parameters:
aMessage
- The message to be logged.
-
alert
public void alert(java.lang.String aMessage, java.lang.Throwable aThrowable)
Logs a log message with log priorityLogPriority.ALERT
.- Specified by:
alert
in interfaceRuntimeLogger
- Parameters:
aMessage
- The message to be logged.aThrowable
- An exception that the message should contain.
-
isLogAlert
public boolean isLogAlert()
Determines whether theRuntimeLogger
is being configured to log fatal messages (LogPriority.ALERT
). This method is useful to prevent the generation of vast amounts of log messageString
objects (and according processing) for the accordingLogPriority
in case them messages of thatLogPriority
are not logged at all.- Specified by:
isLogAlert
in interfaceRuntimeLogger
- Returns:
- True in case fatal messages are logged.
-
panic
public void panic(java.lang.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:
panic
in interfaceRuntimeLogger
- Parameters:
aMessage
- The message to be logged.
-
panic
public void panic(java.lang.String aMessage, java.lang.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:
panic
in interfaceRuntimeLogger
- Parameters:
aMessage
- The message to be logged.aThrowable
- An exception that the message should contain.
-
isLogPanic
public boolean isLogPanic()
Determines whether theRuntimeLogger
is being configured to log fatal messages (LogPriority.PANIC
). This method is useful to prevent the generation of vast amounts of log messageString
objects (and according processing) for the accordingLogPriority
in case them messages of thatLogPriority
are not logged at all.- Specified by:
isLogPanic
in interfaceRuntimeLogger
- Returns:
- True in case fatal messages are logged.
-
log
public void log(LogPriority aPriority, java.lang.String aMessage, java.lang.Object... aArguments)
Creates a new log message. The placeholders in the messageString
are 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:
log
in 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, java.lang.String aMessage, java.lang.Throwable aThrowable, java.lang.Object... aArguments)
Creates a new log message. The placeholders in the messageString
are 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:
log
in 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(java.lang.String aMessage, java.lang.Object... aArguments)
Logs a log message with log priorityLogPriority.TRACE
. The placeholders in the messageString
are 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:
trace
in interfaceRuntimeLogger
- Parameters:
aMessage
- The message to be logged.aArguments
- The arguments used when replacing the placeholders.
-
debug
public void debug(java.lang.String aMessage, java.lang.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 messageString
are 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:
debug
in interfaceRuntimeLogger
- Parameters:
aMessage
- The message to be logged.aArguments
- The arguments used when replacing the placeholders.
-
info
public void info(java.lang.String aMessage, java.lang.Object... aArguments)
Logs a log message with log priorityLogPriority.INFO
. "Additional information which might be useful for some stability period." The placeholders in the messageString
are 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:
info
in interfaceRuntimeLogger
- Parameters:
aMessage
- The message to be logged.aArguments
- The arguments used when replacing the placeholders.
-
notice
public void notice(java.lang.String aMessage, java.lang.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 messageString
are 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:
notice
in interfaceRuntimeLogger
- Parameters:
aMessage
- The message to be logged.aArguments
- The arguments used when replacing the placeholders.
-
warn
public void warn(java.lang.String aMessage, java.lang.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 messageString
are 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:
warn
in interfaceRuntimeLogger
- Parameters:
aMessage
- The message to be logged.aArguments
- The arguments used when replacing the placeholders.
-
warn
public void warn(java.lang.String aMessage, java.lang.Throwable aThrowable, java.lang.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 messageString
are 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:
warn
in 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(java.lang.String aMessage, java.lang.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 messageString
are 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:
error
in interfaceRuntimeLogger
- Parameters:
aMessage
- The message to be logged.aArguments
- The arguments used when replacing the placeholders.
-
error
public void error(java.lang.String aMessage, java.lang.Throwable aThrowable, java.lang.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 messageString
are 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:
error
in 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(java.lang.String aMessage, java.lang.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 messageString
are 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:
critical
in interfaceRuntimeLogger
- Parameters:
aMessage
- The message to be logged.aArguments
- The arguments used when replacing the placeholders.
-
critical
public void critical(java.lang.String aMessage, java.lang.Throwable aThrowable, java.lang.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:
critical
in 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(java.lang.String aMessage, java.lang.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 messageString
are 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:
alert
in interfaceRuntimeLogger
- Parameters:
aMessage
- The message to be logged.aArguments
- The arguments used when replacing the placeholders.
-
alert
public void alert(java.lang.String aMessage, java.lang.Throwable aThrowable, java.lang.Object... aArguments)
Logs a log message with log priorityLogPriority.ALERT
.- Specified by:
alert
in 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(java.lang.String aMessage, java.lang.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 messageString
are 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:
panic
in interfaceRuntimeLogger
- Parameters:
aMessage
- The message to be logged.aArguments
- The arguments used when replacing the placeholders.
-
panic
public void panic(java.lang.String aMessage, java.lang.Throwable aThrowable, java.lang.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 messageString
are 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:
panic
in 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<java.lang.Object> aLogger)
Sets the logger for the logger property.- Specified by:
setLogger
in interfaceLoggerAccessor.LoggerMutator<Logger<java.lang.Object>>
- Parameters:
aLogger
- The logger to be stored by the logger property.
-
setLogLevel
public void setLogLevel(java.lang.String aLogLevel)
Similar tosetLogPriority(LogPriority)
with the difference, that aString
is passed instead of aLogPriority
element. TheString
variant is required by the configuration framework as used by theRuntimeLoggerSingleton
.- Parameters:
aLogLevel
- TheString
representation of the requiredLogPriority
.
-
setLogPriority
public void setLogPriority(LogPriority aLogPriority)
Sets theLogPriority
for theLogPriorityAccessor
.- Specified by:
setLogPriority
in interfaceLogPriorityAccessor.LogPriorityMutator
- Parameters:
aLogPriority
- TheLogPriority
to be stored by theLogPriorityAccessor
.
-
getName
public java.lang.String getName()
- Specified by:
getName
in interfaceorg.refcodes.mixin.NameAccessor
-
setName
public void setName(java.lang.String aName)
- Specified by:
setName
in interfaceorg.refcodes.mixin.NameAccessor.NameMutator
-
printSeparator
public void printSeparator()
Prints a separator line in case the underlyingLogger
supports 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:
printSeparator
in interfaceRuntimeLogger
-
doLog
protected void doLog(LogPriority aPriority, java.lang.String aMessage, java.lang.StackTraceElement aStackTraceElement, java.lang.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
- TheException
to be logged.
-
getCallerStackTraceElement
public static java.lang.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.
-
-