View Javadoc

    1   /*
    2    * Licensed to the Apache Software Foundation (ASF) under one or more
    3    * contributor license agreements. See the NOTICE file distributed with
    4    * this work for additional information regarding copyright ownership.
    5    * The ASF licenses this file to You under the Apache license, Version 2.0
    6    * (the "License"); you may not use this file except in compliance with
    7    * the License. You may obtain a copy of the License at
    8    *
    9    *      http://www.apache.org/licenses/LICENSE-2.0
    10   *
    11   * Unless required by applicable law or agreed to in writing, software
    12   * distributed under the License is distributed on an "AS IS" BASIS,
    13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    14   * See the license for the specific language governing permissions and
    15   * limitations under the license.
    16   */
    17  package org.apache.logging.log4j.core;
    18
    19  /**
    20   * Appenders may delegate their error handling to <code>ErrorHandlers</code>.
    21   * TODO if the appender interface is simplified, then error handling could just be done by wrapping
    22   *  a nested appender. (RG) Please look at DefaultErrorHandler. It's purpose is to make sure the console
    23   * or error log isn't flooded with messages. I'm still considering the Appender refactoring.
    24   */
    25  public interface ErrorHandler {
    26
    27      /**
    28       * Handle an error with a message.
    29       * @param msg The message.
    30       */
    31      void error(String msg);
    32
    33      /**
    34       * Handle an error with a message and an exception.
    35       * @param msg The message.
    36       * @param t The Throwable.
    37       */
    38      void error(String msg, Throwable t);
    39
    40      /**
    41       * Handle an error with a message, and exception and a logging event.
    42       * @param msg The message.
    43       * @param event The LogEvent.
    44       * @param t The Throwable.
    45       */
    46      void error(String msg, LogEvent event, Throwable t);
    47  }