public class FallbackErrorHandler extends Object implements ErrorHandler
The error message is printed on System.err
, and logged in the new secondary appender.
Constructor and Description |
---|
FallbackErrorHandler() |
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 primary)
The appender to which this error handler is attached.
|
void |
setBackupAppender(Appender backup)
Set the backup appender.
|
void |
setLogger(Logger logger)
Adds the logger passed as parameter to the list of loggers that we need to search for in case of appender
failure.
|
public void activateOptions()
public void error(String message)
System.err
.error
in interface ErrorHandler
message
- The message associated with the error.public void error(String message, Exception e, int errorCode)
System.err
.error
in interface ErrorHandler
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.public void error(String message, Exception e, int errorCode, LoggingEvent event)
System.err
.error
in interface ErrorHandler
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.public void setAppender(Appender primary)
setAppender
in interface ErrorHandler
primary
- The appenderpublic void setBackupAppender(Appender backup)
setBackupAppender
in interface ErrorHandler
backup
- The backup appenderpublic void setLogger(Logger logger)
setLogger
in interface ErrorHandler
logger
- One of the loggers that will be searched for the failing
appender in view of replacement.Copyright © 1999-2022 The Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.