|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.wraplog.AbstractLogger
Abstract base class to write messages about interesting things happening to a log.
Constructor Summary | |
AbstractLogger()
|
Method Summary | |
protected void |
checkLevel(int logLevel,
String name)
Check that logLevel is a valid value for variable
name . |
void |
debug(String message)
Log a debug message. |
void |
debug(String format,
Object item)
Log a template based debug message, where the first {} is be replaced by a string reprenentation of item . |
void |
debug(String format,
Object firstItem,
Object secondItem)
Log a template based debug message, where the first {} is be replaced by a string reprenentation of firstItem and the second one by
secondItem . |
void |
debug(String message,
Throwable error)
Log a debug message with a related stack trace. |
void |
error(String message)
|
void |
error(String format,
Object item)
|
void |
error(String format,
Object firstItem,
Object secondItem)
|
void |
error(String message,
Throwable error)
|
int |
getLevel()
|
int |
getLoggedMessageCount()
Count of how many messages have been logged. |
protected void |
handleError(String message)
Handle an error described by message . |
protected void |
handleError(String message,
Throwable error,
String originalMessage,
Throwable originalError)
Handle an error described by message caused by
error while logging originalMessage and
originalError . |
void |
info(String message)
|
void |
info(String format,
Object item)
|
void |
info(String format,
Object firstItem,
Object secondItem)
|
void |
info(String message,
Throwable error)
|
boolean |
isDebugEnabled()
|
boolean |
isEnabled(int logLevel)
|
boolean |
isErrorEnabled()
|
boolean |
isInfoEnabled()
|
boolean |
isWarnEnabled()
|
void |
log(int logLevel,
String message)
Provided that getLevel() accepts it, log
message . |
void |
log(int logLevel,
String format,
Object item)
|
void |
log(int logLevel,
String format,
Object firstItem,
Object secondItem)
|
void |
log(int logLevel,
String message,
Throwable error)
Provided that getLevel() accepts it, log
message and error . |
protected abstract void |
reallyLog(int logLevel,
String message,
Throwable error)
Log a message and optional error details. |
void |
setLevel(int newLevel)
|
static void |
setLoggingErrorHandler(LoggingErrorHandler newErrorHandler)
Set the handler to be called when a message cannot be logged. |
void |
warn(String message)
|
void |
warn(String format,
Object item)
|
void |
warn(String format,
Object firstItem,
Object secondItem)
|
void |
warn(String message,
Throwable error)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public AbstractLogger()
Method Detail |
protected void checkLevel(int logLevel, String name)
logLevel
is a valid value for variable
name
. If not, call handleError()
.
logLevel
- the level to validatename
- the name of the variable that contains the value or
null
handleError(String, Throwable, String, Throwable)
public void debug(String message)
public void debug(String format, Object item)
item
.
public void debug(String format, Object firstItem, Object secondItem)
firstItem
and the second one by
secondItem
.
public void debug(String message, Throwable error)
public void error(String message)
public void error(String format, Object item)
public void error(String format, Object firstItem, Object secondItem)
public void error(String message, Throwable error)
protected void handleError(String message)
message
.
protected void handleError(String message, Throwable error, String originalMessage, Throwable originalError)
message
caused by
error
while logging originalMessage
and
originalError
.
message
- the message describing the error that prevents
originalMessage
from being loggederror
- null
or the error that prevents
originalMessage
from being loggedoriginalMessage
- null
the message that cannot be loggedoriginalError
- null
or the error that cannot be loggedpublic void log(int logLevel, String format, Object item)
public void log(int logLevel, String format, Object firstItem, Object secondItem)
public int getLevel()
public int getLoggedMessageCount()
public void info(String message)
public void info(String message, Throwable error)
public void info(String format, Object item)
public void info(String format, Object firstItem, Object secondItem)
public boolean isEnabled(int logLevel)
protected abstract void reallyLog(int logLevel, String message, Throwable error) throws Exception
logLevel
- one of: Level.DEBUG, Level.INFO, Level.WARN, Level.ERRORmessage
- the actual message; this will never be null
error
- an error that is related to the message; unless
null
, the name and stack trace of the error
are logged
Exception
public void log(int logLevel, String message)
getLevel()
accepts it, log
message
. Otherwise, do nothing.
public void log(int logLevel, String message, Throwable error)
getLevel()
accepts it, log
message
and error
. Otherwise, do nothing.
public void setLevel(int newLevel)
public static void setLoggingErrorHandler(LoggingErrorHandler newErrorHandler)
LoggingException
public boolean isDebugEnabled()
public boolean isInfoEnabled()
public boolean isWarnEnabled()
public boolean isErrorEnabled()
public void warn(String message)
public void warn(String format, Object item)
public void warn(String format, Object firstItem, Object secondItem)
public void warn(String message, Throwable error)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |