public class OnlyOnceErrorHandler extends Object implements ErrorHandler
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.
| Constructor and Description |
|---|
OnlyOnceErrorHandler() |
| Modifier and Type | Method and Description |
|---|---|
void |
activateOptions()
No options to activate.
|
void |
error(String message)
Print a the error message passed as parameter on
System.err. |
void |
error(String message,
Exception e,
int errorCode)
Prints the message and the stack trace of the exception on
System.err. |
void |
error(String message,
Exception e,
int errorCode,
LoggingEvent event)
Prints the message and the stack trace of the exception on
System.err. |
void |
setAppender(Appender appender)
Does not do anything.
|
void |
setBackupAppender(Appender appender)
Does not do anything.
|
void |
setLogger(Logger logger)
Does not do anything.
|
public void setLogger(Logger logger)
setLogger in interface ErrorHandlerlogger - One of the loggers that will be searched for the failing
appender in view of replacement.public void activateOptions()
activateOptions in interface OptionHandlerpublic void error(String message, Exception e, int errorCode)
System.err.error in interface ErrorHandlerpublic void error(String message, Exception e, int errorCode, LoggingEvent event)
System.err.error in interface ErrorHandlermessage - The message assoicated with the error.e - The Exption that was thrown when the error occured.errorCode - The error code associated with the error.event - The logging event that the failing appender is asked
to log.public void error(String message)
System.err.error in interface ErrorHandlerpublic void setAppender(Appender appender)
setAppender in interface ErrorHandlerpublic void setBackupAppender(Appender appender)
setBackupAppender in interface ErrorHandlerCopyright © 2012 JBoss by Red Hat. All Rights Reserved.