Package org.apache.log4j.helpers
Class OnlyOnceErrorHandler
java.lang.Object
org.apache.log4j.helpers.OnlyOnceErrorHandler
- All Implemented Interfaces:
ErrorHandler
,OptionHandler
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.
- Since:
- 0.9.0
- Author:
- Ceki Gülcü
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
No options to activate.void
Print a the error message passed as parameter onSystem.err
.void
Prints the message and the stack trace of the exception onSystem.err
.void
error
(String message, Exception e, int errorCode, LoggingEvent event) Prints the message and the stack trace of the exception onSystem.err
.void
setAppender
(Appender appender) Does not do anything.void
setBackupAppender
(Appender appender) Does not do anything.void
Does not do anything.
-
Constructor Details
-
OnlyOnceErrorHandler
public OnlyOnceErrorHandler()
-
-
Method Details
-
setLogger
Does not do anything.- Specified by:
setLogger
in interfaceErrorHandler
- Parameters:
logger
- One of the loggers that will be searched for the failing appender in view of replacement.
-
activateOptions
public void activateOptions()No options to activate.- Specified by:
activateOptions
in interfaceOptionHandler
-
error
Prints the message and the stack trace of the exception onSystem.err
.- Specified by:
error
in interfaceErrorHandler
-
error
Prints the message and the stack trace of the exception onSystem.err
.- Specified by:
error
in interfaceErrorHandler
- Parameters:
message
- 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.
-
error
Print a the error message passed as parameter onSystem.err
.- Specified by:
error
in interfaceErrorHandler
-
setAppender
Does not do anything.- Specified by:
setAppender
in interfaceErrorHandler
-
setBackupAppender
Does not do anything.- Specified by:
setBackupAppender
in interfaceErrorHandler
-