|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--uk.org.ogsadai.common.msgs.DAILogger
Class responsible for logging.
Handles internationalization of logging messages and forces developers to internationalise messages that are logged at any level higher than DEBUG
.
Field Summary | |
private static java.lang.String |
COPYRIGHT_NOTICE Copyright statement |
private boolean |
debugEnabled Is the DEBUG level of logging enabled? |
private java.lang.Class |
mClass Class for which logging is being managed |
private org.apache.log4j.Logger |
mLogger Log4J Logger used for logging |
Constructor Summary | |
private |
DAILogger(java.lang.Class theClass) Private constructor. |
Method Summary | |
private java.lang.String |
addIDToMessage(DAIUniqueID id, java.lang.String message) Adds a unique ID to a message string. |
void |
debug(DAIUniqueID id, java.lang.String message) Logs a debug message with the given ID. |
void |
debug(java.lang.String message) Logs a debug message. |
void |
error(java.lang.Throwable exception) Logs a set of internationalized error messages associated with the given exception and all its child exceptions. |
void |
error(java.lang.Throwable exception, boolean stackTrace) Logs a set of internationalized error messages associated with the given exception and all its child exceptions. |
private void |
errorExceptionAndChildren(java.lang.Throwable e, boolean stackTrace) Logs as a warning the given exception and all its children. |
void |
fatal(java.lang.Throwable exception) Logs a set of internationalized fatal messages associated with the given exception and all its child exceptions. |
void |
fatal(java.lang.Throwable exception, boolean stackTrace) Logs a set of internationalized fatal messages associated with the given exception and all its child exceptions. |
private void |
fatalExceptionAndChildren(java.lang.Throwable e, boolean stackTrace) Logs as a warning the given exception and all its children. |
private java.lang.String |
getLocalizedMessage(DAIUniqueID id, MessageID messageID, java.lang.Object[] parameters) Gets the internationalized message from the message loader and appends the unique ID to it. |
private java.lang.String |
getLocalizedMessage(MessageID messageID, java.lang.Object[] parameters) Gets the internationalized message from the message loader. |
static DAILogger |
getLogger(java.lang.Class theClass) Factory method to get a logger for the specified class. |
private java.lang.String |
getStackTrace(java.lang.Throwable ex) Get an exception stack trace as a string. |
void |
info(MessageID messageID) Logs the internationalized information message associated with the given message ID. |
void |
info(MessageID messageID, java.lang.Object parameter) Logs the internationalized information message associated with the given message ID using the given parameters. |
void |
info(MessageID messageID, java.lang.Object[] parameters) Logs the internationalized information message associated with the given message ID using the given parameters. |
boolean |
isDebugEnabled() Gets whether or not debug logging in enabled. |
boolean |
isInfoEnabled() Gets whether or not informational logging in enabled. |
private void |
logStackTraceDebug(java.lang.Throwable e) Log an exception stack trace. |
private void |
logStackTraceError(java.lang.Throwable e) Log an exception stack trace. |
private void |
logStackTraceFatal(java.lang.Throwable e) Log an exception stack trace. |
private void |
logStackTraceWarn(java.lang.Throwable e) Log an exception stack trace. |
(package private) void |
warn(ErrorID errorID, java.lang.Object[] parameters) Logs a bare bones warning message associated with the given error ID using the given parameters. |
void |
warn(java.lang.Throwable exception) Logs a set of internationalized warning messages associated with the given exception and all its child exceptions. |
void |
warn(java.lang.Throwable exception, boolean stackTrace) Logs a set of internationalized warning messages associated with the given exception and all its child exceptions. |
private void |
warnExceptionAndChildren(java.lang.Throwable e, boolean stackTrace) Logs as a warning the given exception and all its children. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final java.lang.String COPYRIGHT_NOTICE
private java.lang.Class mClass
private org.apache.log4j.Logger mLogger
private boolean debugEnabled
DEBUG
level of logging enabled?
Constructor Detail |
private DAILogger(java.lang.Class theClass)
theClass
- The class being logged.Method Detail |
public static DAILogger getLogger(java.lang.Class theClass)
theClass
- The class being logged.public void debug(java.lang.String message)
message
- The debug message to log.public void debug(DAIUniqueID id, java.lang.String message)
id
- ID to log with message.message
- The debug message to log.public boolean isDebugEnabled()
true
if logging is enabled, false
otherwise.public void info(MessageID messageID)
messageID
- Message ID identifying message to log.public void info(MessageID messageID, java.lang.Object parameter)
messageID
- Message ID identifying message to log.parameter
- Parameter associated with message. The toString()
method will be applied to the parameter to obtain the string inserted into the message log.public void info(MessageID messageID, java.lang.Object[] parameters)
messageID
- Message ID identifying message to log.parameters
- Parameters associated with message. The toString()
method will be applied to all parameters to obtain the strings inserted into the message log.public boolean isInfoEnabled()
true
if logging is enabled, false
otherwise.public void warn(java.lang.Throwable exception)
exception
- Exception containing messages to be logged.public void warn(java.lang.Throwable exception, boolean stackTrace)
exception
- Exception containing messages to be logged.stackTrace
- Log the stack trace?public void error(java.lang.Throwable exception)
exception
- Exception containing messages to be logged.public void error(java.lang.Throwable exception, boolean stackTrace)
exception
- Exception containing messages to be logged.stackTrace
- Log the stack trace?void warn(ErrorID errorID, java.lang.Object[] parameters)
MessageLoader
if it cannot find a message bundle.
errorID
- Error ID identifying message to log.parameters
- Parameters associated with message. The toString()
method will be applied to all parameters to obtain the strings inserted into the message log.public void fatal(java.lang.Throwable exception)
exception
- Exception containing messages to be logged.public void fatal(java.lang.Throwable exception, boolean stackTrace)
exception
- Exception containing messages to be logged.stackTrace
- Log the stack trace?private void warnExceptionAndChildren(java.lang.Throwable e, boolean stackTrace)
Each exception and its children will be logged with messages from any exception implementing uk.org.ogsadai.exception.DAIExceptionInformation
being internationalized.
e
- Exception to log.stackTrace
- Log the stack trace?private void errorExceptionAndChildren(java.lang.Throwable e, boolean stackTrace)
Each exception and its children will be logged with messages from any exception implementing uk.org.ogsadai.exception.DAIExceptionInformation
being internationalized.
e
- Exception to logstackTrace
- Log the stack trace?private void fatalExceptionAndChildren(java.lang.Throwable e, boolean stackTrace)
Each exception and its children will be logged with messages from any exception implementing uk.org.ogsadai.exception.DAIExceptionInformation
being internationalized.
e
- Exception to logstackTrace
- Log the stack trace?private java.lang.String getLocalizedMessage(MessageID messageID, java.lang.Object[] parameters)
messageID
- ID of message.parameters
- Parameters to insert into message. The toString()
method will be applied to all parameters to obtain the strings inserted into the message log.private java.lang.String getLocalizedMessage(DAIUniqueID id, MessageID messageID, java.lang.Object[] parameters)
id
- Unique ID to associate with this message.messageID
- ID of message.parameters
- Parameters to insert into message. The toString()
method will be applied to all parameters to obtain the strings inserted into the message log.private java.lang.String addIDToMessage(DAIUniqueID id, java.lang.String message)
id
- Unique ID associated with messagemessage
- The message.#id# message
.private java.lang.String getStackTrace(java.lang.Throwable ex)
ex
- Exception.private void logStackTraceDebug(java.lang.Throwable e)
e
- Exception.private void logStackTraceWarn(java.lang.Throwable e)
e
- Exception.private void logStackTraceError(java.lang.Throwable e)
e
- Exception.private void logStackTraceFatal(java.lang.Throwable e)
e
- Exception.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |