Package org.apache.log4j.varia
Class FallbackErrorHandler
java.lang.Object
org.apache.log4j.varia.FallbackErrorHandler
- All Implemented Interfaces:
ErrorHandler
An ErrorHandler with a secondary appender. This secondary appender takes over if the primary appender fails for
whatever reason.
The error message is printed on System.err, and logged in the new secondary appender.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidNo options to activate.voidPrint a the error message passed as parameter onSystem.err.voidPrints the message and the stack trace of the exception onSystem.err.voiderror(String message, Exception e, int errorCode, LoggingEvent event) Prints the message and the stack trace of the exception onSystem.err.voidsetAppender(Appender primary) The appender to which this error handler is attached.voidsetBackupAppender(Appender backup) Set the backup appender.voidAdds the logger passed as parameter to the list of loggers that we need to search for in case of appender failure.
-
Constructor Details
-
FallbackErrorHandler
public FallbackErrorHandler()
-
-
Method Details
-
activateOptions
public void activateOptions()No options to activate. -
error
Print a the error message passed as parameter onSystem.err.- Specified by:
errorin interfaceErrorHandler- Parameters:
message- The message associated with the error.
-
error
Prints the message and the stack trace of the exception onSystem.err.- Specified by:
errorin interfaceErrorHandler- Parameters:
message- The message associated with the error.e- The Exception that was thrown when the error occurred.errorCode- The error code associated with the error.
-
error
Prints the message and the stack trace of the exception onSystem.err.- Specified by:
errorin interfaceErrorHandler- Parameters:
message- The message associated with the error.e- The Exception that was thrown when the error occurred.errorCode- The error code associated with the error.event- The logging event that the failing appender is asked to log.
-
setAppender
The appender to which this error handler is attached.- Specified by:
setAppenderin interfaceErrorHandler- Parameters:
primary- The appender
-
setBackupAppender
Set the backup appender.- Specified by:
setBackupAppenderin interfaceErrorHandler- Parameters:
backup- The backup appender
-
setLogger
Adds the logger passed as parameter to the list of loggers that we need to search for in case of appender failure.- Specified by:
setLoggerin interfaceErrorHandler- Parameters:
logger- One of the loggers that will be searched for the failing appender in view of replacement.
-