Class AbstractLogger
- java.lang.Object
-
- com.sodius.mdw.core.util.log.AbstractLogger
-
- All Implemented Interfaces:
Logger
- Direct Known Subclasses:
FileLogger,LogRecorder,NullLogger,SystemStreamLogger
public abstract class AbstractLogger extends Object implements Logger
Skeletal implementation of theLoggerinterface. Subclasses should generally only have to implement thelog()method, as any other logging facility (debug(),error(), etc.) is redirected to this method using the correspondingLevelinformation.Clients may subclass this class.
-
-
Constructor Summary
Constructors Constructor Description AbstractLogger()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected StringcreateMessage(Object message, String filename, int line, int column)Creates a log string based on the specified message and file location.voiddebug(Object message)Logs a debug level message.voiddebug(Object message, String filename, int lineNumber, int columnNumber)Logs a debug level message.voiddebug(Object message, Throwable error)Logs a debug level message.voiderror(Object message)Logs an error level message.voiderror(Object message, String filename, int lineNumber, int columnNumber)Logs an error level message.voiderror(Object message, Throwable error)Logs an error level message.LevelgetLevel()Get the log Level that has been specified for this logger.voidinfo(Object message)Logs an info level message.voidinfo(Object message, String filename, int lineNumber, int columnNumber)Logs an info level message, with the specified file location.voidinfo(Object message, Throwable error)Logs an info level message.booleanisLoggable(Level level)Check if a message of the given level would actually be logged by this logger.protected abstract voidlog(Level level, Object message, Throwable error)Ask to log the specified message and error.voidsetLevel(Level level)Set the log level specifying which message levels will be logged by this logger.voidwarning(Object message)Logs a warning level message.voidwarning(Object message, String filename, int lineNumber, int columnNumber)Logs a warning level message.voidwarning(Object message, Throwable error)Logs a warning level message.
-
-
-
Method Detail
-
getLevel
public Level getLevel()
Description copied from interface:LoggerGet the log Level that has been specified for this logger. The default level isINFO.
-
setLevel
public void setLevel(Level level)
Description copied from interface:LoggerSet the log level specifying which message levels will be logged by this logger. Message levels lower than this value will be discarded.
-
createMessage
protected String createMessage(Object message, String filename, int line, int column)
Creates a log string based on the specified message and file location.- Parameters:
message- the information to log (usually aString)filename- the current file from which this message originates.line- the current file line number.column- the current file column number.- Returns:
- a log information.
-
log
protected abstract void log(Level level, Object message, Throwable error)
Ask to log the specified message and error. Implementors can safely assume the level has be checked to be loggable at this stage.- Parameters:
level- the log level (known to be loggable).message- the information to log (usually aString), maybenull.error- an exception to log, maybenull.
-
isLoggable
public boolean isLoggable(Level level)
Description copied from interface:LoggerCheck if a message of the given level would actually be logged by this logger. This check is based on the logger effective level.- Specified by:
isLoggablein interfaceLogger- Parameters:
level- a message logging level.- Returns:
trueif the given message level is currently being logged.
-
debug
public void debug(Object message)
Description copied from interface:LoggerLogs a debug level message.Debug messages are used to assist in debugging problems that may be associated with particular configurations.
-
debug
public void debug(Object message, String filename, int lineNumber, int columnNumber)
Description copied from interface:LoggerLogs a debug level message.This method is typically used when parsing a model file and when a parsing debug information must be logged.
Debug messages are used to assist in debugging problems that may be associated with particular configurations.
-
debug
public void debug(Object message, Throwable error)
Description copied from interface:LoggerLogs a debug level message.Debug messages are used to assist in debugging problems that may be associated with particular configurations.
-
info
public void info(Object message)
Description copied from interface:LoggerLogs an info level message.Info messages should only be used for reasonably significant messages that will make sense to end users and system admins.
-
info
public void info(Object message, String filename, int lineNumber, int columnNumber)
Description copied from interface:LoggerLogs an info level message, with the specified file location.This method is typically used when parsing a model file and when a parsing information must be logged.
Info messages should only be used for reasonably significant messages that will make sense to end users and system admins.
-
info
public void info(Object message, Throwable error)
Description copied from interface:LoggerLogs an info level message.Info messages should only be used for reasonably significant messages that will make sense to end users and system admins.
-
warning
public void warning(Object message)
Description copied from interface:LoggerLogs a warning level message.In general, warning messages should describe events that will be of interest to end users or system managers, or which indicate potential problems.
-
warning
public void warning(Object message, String filename, int lineNumber, int columnNumber)
Description copied from interface:LoggerLogs a warning level message.This method is typically used when parsing a model file and when a parsing warning must be logged.
In general, warning messages should describe events that will be of interest to end users or system managers, or which indicate potential problems.
-
warning
public void warning(Object message, Throwable error)
Description copied from interface:LoggerLogs a warning level message.In general, warning messages should describe events that will be of interest to end users or system managers, or which indicate potential problems.
-
error
public void error(Object message)
Description copied from interface:LoggerLogs an error level message.In general, error messages should describe events that are of considerable importance and which will prevent normal program execution. They should be reasonably intelligible to end users and to system administrators.
-
error
public void error(Object message, String filename, int lineNumber, int columnNumber)
Description copied from interface:LoggerLogs an error level message.This method is typically used when parsing a model file and when a parsing recoverable error must be logged.
In general, error messages should describe events that are of considerable importance and which will prevent normal program execution. They should be reasonably intelligible to end users and to system administrators.
-
error
public void error(Object message, Throwable error)
Description copied from interface:LoggerLogs an error level message.In general, error messages should describe events that are of considerable importance and which will prevent normal program execution. They should be reasonably intelligible to end users and to system administrators.
-
-