Package com.bw.jtools.log
Class CollectorLogger
- java.lang.Object
-
- com.bw.jtools.Log.LoggerFacade
-
- com.bw.jtools.log.CollectorLogger
-
public class CollectorLogger extends Log.LoggerFacade
Logger back-end that collects messages in memory.
Purpose is to collect errors and warnings during some operation to enable the software to give hints about the reason of failure. E.g by providing an detailed error-report about the operation.
It is used byLog.startCollectMessages(int, boolean).
-
-
Field Summary
Fields Modifier and Type Field Description java.util.HashMap<java.lang.Long,CollectorThreadLogger>threadLogger-
Fields inherited from class com.bw.jtools.Log.LoggerFacade
DEBUG_PREFIX, ERROR_PREFIX, INFO_PREFIX, level, maxStackTraceLines, UNKNW_PREFIX, WARN_PREFIX
-
-
Constructor Summary
Constructors Constructor Description CollectorLogger()Creates a new CollectorLogger.
-
Method Summary
Modifier and Type Method Description protected voidaddMessage(int level, java.lang.CharSequence msg, java.lang.Throwable t)voiddebug(java.lang.CharSequence msg)Logs a debugging message.voiddebug(java.lang.CharSequence msg, java.lang.Throwable t)Logs a warning message error plus message and stack-trace of the Throwable.voiderror(java.lang.CharSequence msg)Logs an error message.voiderror(java.lang.CharSequence msg, java.lang.Throwable t)Logs an error message plus message and stack-trace of the Throwable.CollectorThreadLoggergetThreadLog()booleanhasThreadLog()voidinfo(java.lang.CharSequence msg)Logs an informational message.voidinfo(java.lang.CharSequence msg, java.lang.Throwable t)Logs an informational message error plus message and stack-trace of the Throwable.voidsetThreadLog(CollectorThreadLogger tlog)voidwarn(java.lang.CharSequence msg)Logs a warning message.voidwarn(java.lang.CharSequence msg, java.lang.Throwable t)Logs a warning message error plus message and stack-trace of the Throwable.-
Methods inherited from class com.bw.jtools.Log.LoggerFacade
getLevel, getLevelPrefix, isDebugEnabled, isErrorEnabled, isInfoEnabled, isWarnEnabled, setLevel, setMaximumLinesOfStackTrace
-
-
-
-
Field Detail
-
threadLogger
public java.util.HashMap<java.lang.Long,CollectorThreadLogger> threadLogger
-
-
Method Detail
-
addMessage
protected void addMessage(int level, java.lang.CharSequence msg, java.lang.Throwable t)
-
getThreadLog
public CollectorThreadLogger getThreadLog()
-
hasThreadLog
public boolean hasThreadLog()
-
setThreadLog
public void setThreadLog(CollectorThreadLogger tlog)
-
error
public void error(java.lang.CharSequence msg)
Description copied from class:Log.LoggerFacadeLogs an error message.- Specified by:
errorin classLog.LoggerFacade- Parameters:
msg- The text to log.
-
warn
public void warn(java.lang.CharSequence msg)
Description copied from class:Log.LoggerFacadeLogs a warning message.- Specified by:
warnin classLog.LoggerFacade- Parameters:
msg- The text to log.
-
info
public void info(java.lang.CharSequence msg)
Description copied from class:Log.LoggerFacadeLogs an informational message.- Specified by:
infoin classLog.LoggerFacade- Parameters:
msg- The text to log.
-
debug
public void debug(java.lang.CharSequence msg)
Description copied from class:Log.LoggerFacadeLogs a debugging message.- Specified by:
debugin classLog.LoggerFacade- Parameters:
msg- The text to log.
-
error
public void error(java.lang.CharSequence msg, java.lang.Throwable t)Description copied from class:Log.LoggerFacadeLogs an error message plus message and stack-trace of the Throwable.- Overrides:
errorin classLog.LoggerFacade- Parameters:
msg- The text to log.t- The Throwable to trace.
-
warn
public void warn(java.lang.CharSequence msg, java.lang.Throwable t)Description copied from class:Log.LoggerFacadeLogs a warning message error plus message and stack-trace of the Throwable.- Overrides:
warnin classLog.LoggerFacade- Parameters:
msg- The text to log.t- The Throwable to trace.
-
debug
public void debug(java.lang.CharSequence msg, java.lang.Throwable t)Description copied from class:Log.LoggerFacadeLogs a warning message error plus message and stack-trace of the Throwable.- Overrides:
debugin classLog.LoggerFacade- Parameters:
msg- The text to log.t- The Throwable to trace.
-
info
public void info(java.lang.CharSequence msg, java.lang.Throwable t)Description copied from class:Log.LoggerFacadeLogs an informational message error plus message and stack-trace of the Throwable.- Overrides:
infoin classLog.LoggerFacade- Parameters:
msg- The text to log.t- The Throwable to trace.
-
-