org.apache.log4j.helpers
public class: OnlyOnceErrorHandler [javadoc |
source]
java.lang.Object
org.apache.log4j.helpers.OnlyOnceErrorHandler
All Implemented Interfaces:
ErrorHandler
The
OnlyOnceErrorHandler implements log4j's default
error handling policy which consists of emitting a message for the
first error in an appender and ignoring all following errors.
The error message is printed on System.err.
This policy aims at protecting an otherwise working application
from being flooded with error messages when logging fails.
- author:
Ceki - Gülcü
- since:
0.9.0 -
| Field Summary |
|---|
| final String | WARN_PREFIX | |
| final String | ERROR_PREFIX | |
| boolean | firstTime | |
| Method from org.apache.log4j.helpers.OnlyOnceErrorHandler Detail: |
public void activateOptions() {
}
|
public void error(String message) {
if(firstTime) {
LogLog.error(message);
firstTime = false;
}
}
Print a the error message passed as parameter on
System.err. |
public void error(String message,
Exception e,
int errorCode) {
error(message, e, errorCode, null);
}
Prints the message and the stack trace of the exception on
System.err. |
public void error(String message,
Exception e,
int errorCode,
LoggingEvent event) {
if(firstTime) {
LogLog.error(message, e);
firstTime = false;
}
}
Prints the message and the stack trace of the exception on
System.err. |
public void setAppender(Appender appender) {
}
|
public void setBackupAppender(Appender appender) {
}
|
public void setLogger(Logger logger) {
}
|