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 */
017
018package org.apache.commons.logging;
019
020/**
021 * An exception that is thrown only if a suitable <code>LogFactory</code>
022 * or <code>Log</code> instance cannot be created by the corresponding
023 * factory methods.
024 *
025 * @version $Id: LogConfigurationException.html 915605 2014-07-09 20:22:43Z tn $
026 */
027public class LogConfigurationException extends RuntimeException {
028
029    /** Serializable version identifier. */
030    private static final long serialVersionUID = 8486587136871052495L;
031
032    /**
033     * Construct a new exception with <code>null</code> as its detail message.
034     */
035    public LogConfigurationException() {
036        super();
037    }
038
039    /**
040     * Construct a new exception with the specified detail message.
041     *
042     * @param message The detail message
043     */
044    public LogConfigurationException(String message) {
045        super(message);
046    }
047
048    /**
049     * Construct a new exception with the specified cause and a derived
050     * detail message.
051     *
052     * @param cause The underlying cause
053     */
054    public LogConfigurationException(Throwable cause) {
055        this(cause == null ? null : cause.toString(), cause);
056    }
057
058    /**
059     * Construct a new exception with the specified detail message and cause.
060     *
061     * @param message The detail message
062     * @param cause The underlying cause
063     */
064    public LogConfigurationException(String message, Throwable cause) {
065        super(message + " (Caused by " + cause + ")");
066        this.cause = cause; // Two-argument version requires JDK 1.4 or later
067    }
068
069    /**
070     * The underlying cause of this exception.
071     */
072    protected Throwable cause = null;
073
074    /**
075     * Return the underlying cause of this exception (if any).
076     */
077    public Throwable getCause() {
078        return this.cause;
079    }
080}