001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements. See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache license, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License. You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the license for the specific language governing permissions and
015 * limitations under the license.
016 */
017package org.apache.logging.log4j.core.appender;
018
019import org.apache.logging.log4j.LoggingException;
020
021/**
022 * Thrown from an appender when a log event could not be written. Appenders should not thrown an exception if an error
023 * occurs that does <em>not</em> stop the event from being successfully written. Those types of errors should be logged
024 * using the {@link org.apache.logging.log4j.status.StatusLogger}. Appenders should only throw exceptions when an error
025 * prevents an event from being written. Appenders <em>must</em> throw an exception in this case so that error-handling
026 * features like the {@link FailoverAppender} work properly.
027 *
028 * Also note that appenders <em>must</em> provide a way to suppress exceptions when the user desires and abide by
029 * that instruction. See {@link org.apache.logging.log4j.core.Appender#ignoreExceptions()}, which is the standard
030 * way to do this.
031 */
032public class AppenderLoggingException extends LoggingException {
033
034    private static final long serialVersionUID = 6545990597472958303L;
035
036    /**
037     * Construct an exception with a message.
038     *
039     * @param message The reason for the exception
040     */
041    public AppenderLoggingException(final String message) {
042        super(message);
043    }
044
045    /**
046     * Construct an exception with a message and underlying cause.
047     *
048     * @param message The reason for the exception
049     * @param cause The underlying cause of the exception
050     */
051    public AppenderLoggingException(final String message, final Throwable cause) {
052        super(message, cause);
053    }
054
055    /**
056     * Construct an exception with an underlying cause.
057     *
058     * @param cause The underlying cause of the exception
059     */
060    public AppenderLoggingException(final Throwable cause) {
061        super(cause);
062    }
063}