Class FallbackErrorHandler

  • All Implemented Interfaces:
    ErrorHandler

    public class FallbackErrorHandler
    extends java.lang.Object
    implements 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.

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void activateOptions()
      No options to activate.
      void error​(java.lang.String message)
      Print a the error message passed as parameter on System.err.
      void error​(java.lang.String message, java.lang.Exception e, int errorCode)
      Prints the message and the stack trace of the exception on System.err.
      void error​(java.lang.String message, java.lang.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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FallbackErrorHandler

        public FallbackErrorHandler()
    • Method Detail

      • activateOptions

        public void activateOptions()
        No options to activate.
      • error

        public void error​(java.lang.String message)
        Print a the error message passed as parameter on System.err.
        Specified by:
        error in interface ErrorHandler
        Parameters:
        message - The message associated with the error.
      • error

        public void error​(java.lang.String message,
                          java.lang.Exception e,
                          int errorCode)
        Prints the message and the stack trace of the exception on System.err.
        Specified by:
        error in interface ErrorHandler
        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

        public void error​(java.lang.String message,
                          java.lang.Exception e,
                          int errorCode,
                          LoggingEvent event)
        Prints the message and the stack trace of the exception on System.err.
        Specified by:
        error in interface ErrorHandler
        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

        public void setAppender​(Appender primary)
        The appender to which this error handler is attached.
        Specified by:
        setAppender in interface ErrorHandler
        Parameters:
        primary - The appender
      • setBackupAppender

        public void setBackupAppender​(Appender backup)
        Set the backup appender.
        Specified by:
        setBackupAppender in interface ErrorHandler
        Parameters:
        backup - The backup appender
      • setLogger

        public 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.
        Specified by:
        setLogger in interface ErrorHandler
        Parameters:
        logger - One of the loggers that will be searched for the failing appender in view of replacement.