Class AbstractAppender

    • Field Detail

      • name

        private final java.lang.String name
      • ignoreExceptions

        private final boolean ignoreExceptions
      • layout

        private final Layout<? extends java.io.Serializable> layout
    • Constructor Detail

      • AbstractAppender

        @Deprecated
        protected AbstractAppender​(java.lang.String name,
                                   Filter filter,
                                   Layout<? extends java.io.Serializable> layout)
        Constructor that defaults to suppressing exceptions.
        Parameters:
        name - The Appender name.
        filter - The Filter to associate with the Appender.
        layout - The layout to use to format the event.
      • AbstractAppender

        @Deprecated
        protected AbstractAppender​(java.lang.String name,
                                   Filter filter,
                                   Layout<? extends java.io.Serializable> layout,
                                   boolean ignoreExceptions)
        Constructor.
        Parameters:
        name - The Appender name.
        filter - The Filter to associate with the Appender.
        layout - The layout to use to format the event.
        ignoreExceptions - If true, exceptions will be logged and suppressed. If false errors will be logged and then passed to the application.
      • AbstractAppender

        protected AbstractAppender​(java.lang.String name,
                                   Filter filter,
                                   Layout<? extends java.io.Serializable> layout,
                                   boolean ignoreExceptions,
                                   Property[] properties)
        Constructor.
        Parameters:
        name - The Appender name.
        filter - The Filter to associate with the Appender.
        layout - The layout to use to format the event.
        ignoreExceptions - If true, exceptions will be logged and suppressed. If false errors will be logged and then passed to the application.
        Since:
        2.11.2
    • Method Detail

      • parseInt

        public static int parseInt​(java.lang.String s,
                                   int defaultValue)
      • error

        public void error​(java.lang.String msg)
        Handle an error with a message using the ErrorHandler configured for this Appender.
        Parameters:
        msg - The message.
      • error

        public void error​(java.lang.String msg,
                          LogEvent event,
                          java.lang.Throwable t)
        Handle an error with a message, exception, and a logging event, using the ErrorHandler configured for this Appender.
        Parameters:
        msg - The message.
        event - The LogEvent.
        t - The Throwable.
      • error

        public void error​(java.lang.String msg,
                          java.lang.Throwable t)
        Handle an error with a message and an exception using the ErrorHandler configured for this Appender.
        Parameters:
        msg - The message.
        t - The Throwable.
      • getHandler

        public ErrorHandler getHandler()
        Returns the ErrorHandler, if any.
        Specified by:
        getHandler in interface Appender
        Returns:
        The ErrorHandler.
      • getLayout

        public Layout<? extends java.io.Serializable> getLayout()
        Returns the Layout for the appender.
        Specified by:
        getLayout in interface Appender
        Returns:
        The Layout used to format the event.
      • getName

        public java.lang.String getName()
        Returns the name of the Appender.
        Specified by:
        getName in interface Appender
        Returns:
        The name of the Appender.
      • ignoreExceptions

        public boolean ignoreExceptions()
        Some appenders need to propagate exceptions back to the application. When ignoreExceptions is false the AppenderControl will allow the exception to percolate.
        Specified by:
        ignoreExceptions in interface Appender
        Returns:
        true if exceptions will be logged but now thrown, false otherwise.
      • setHandler

        public void setHandler​(ErrorHandler handler)
        The handler must be set before the appender is started.
        Specified by:
        setHandler in interface Appender
        Parameters:
        handler - The ErrorHandler to use.
      • toSerializable

        protected java.io.Serializable toSerializable​(LogEvent event)
        Serializes the given event using the appender's layout if present.
        Parameters:
        event - the event to serialize.
        Returns:
        the serialized event or null if no layout is present.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object