Home | History | Annotate | Download | only in logging
      1 /*
      2  * Copyright 2001-2004 The Apache Software Foundation.
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 package org.apache.commons.logging;
     18 
     19 
     20 /**
     21  * <p>An exception that is thrown only if a suitable <code>LogFactory</code>
     22  * or <code>Log</code> instance cannot be created by the corresponding
     23  * factory methods.</p>
     24  *
     25  * @author Craig R. McClanahan
     26  * @version $Revision: 155426 $ $Date: 2005-02-26 13:10:49 +0000 (Sat, 26 Feb 2005) $
     27  */
     28 
     29 public class LogConfigurationException extends RuntimeException {
     30 
     31 
     32     /**
     33      * Construct a new exception with <code>null</code> as its detail message.
     34      */
     35     public LogConfigurationException() {
     36 
     37         super();
     38 
     39     }
     40 
     41 
     42     /**
     43      * Construct a new exception with the specified detail message.
     44      *
     45      * @param message The detail message
     46      */
     47     public LogConfigurationException(String message) {
     48 
     49         super(message);
     50 
     51     }
     52 
     53 
     54     /**
     55      * Construct a new exception with the specified cause and a derived
     56      * detail message.
     57      *
     58      * @param cause The underlying cause
     59      */
     60     public LogConfigurationException(Throwable cause) {
     61 
     62         this((cause == null) ? null : cause.toString(), cause);
     63 
     64     }
     65 
     66 
     67     /**
     68      * Construct a new exception with the specified detail message and cause.
     69      *
     70      * @param message The detail message
     71      * @param cause The underlying cause
     72      */
     73     public LogConfigurationException(String message, Throwable cause) {
     74 
     75         super(message + " (Caused by " + cause + ")");
     76         this.cause = cause; // Two-argument version requires JDK 1.4 or later
     77 
     78     }
     79 
     80 
     81     /**
     82      * The underlying cause of this exception.
     83      */
     84     protected Throwable cause = null;
     85 
     86 
     87     /**
     88      * Return the underlying cause of this exception (if any).
     89      */
     90     public Throwable getCause() {
     91 
     92         return (this.cause);
     93 
     94     }
     95 
     96 
     97 }
     98