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  
18  
19  package org.apache.commons.logging.impl;
20  
21  
22  import java.io.Serializable;
23  import org.apache.commons.logging.Log;
24  
25  
26  /**
27   * <p>Trivial implementation of Log that throws away all messages.  No
28   * configurable system properties are supported.</p>
29   *
30   * @author <a href="mailto:sanders@apache.org">Scott Sanders</a>
31   * @author Rod Waldhoff
32   * @version $Id: NoOpLog.java 424107 2006-07-20 23:15:42Z skitching $
33   */
34  public class NoOpLog implements Log, Serializable {
35  
36      /** Convenience constructor */
37      public NoOpLog() { }
38      /** Base constructor */
39      public NoOpLog(String name) { }
40      /** Do nothing */
41      public void trace(Object message) { }
42      /** Do nothing */
43      public void trace(Object message, Throwable t) { }
44      /** Do nothing */
45      public void debug(Object message) { }
46      /** Do nothing */
47      public void debug(Object message, Throwable t) { }
48      /** Do nothing */
49      public void info(Object message) { }
50      /** Do nothing */
51      public void info(Object message, Throwable t) { }
52      /** Do nothing */
53      public void warn(Object message) { }
54      /** Do nothing */
55      public void warn(Object message, Throwable t) { }
56      /** Do nothing */
57      public void error(Object message) { }
58      /** Do nothing */
59      public void error(Object message, Throwable t) { }
60      /** Do nothing */
61      public void fatal(Object message) { }
62      /** Do nothing */
63      public void fatal(Object message, Throwable t) { }
64  
65      /**
66       * Debug is never enabled.
67       *
68       * @return false
69       */
70      public final boolean isDebugEnabled() { return false; }
71  
72      /**
73       * Error is never enabled.
74       *
75       * @return false
76       */
77      public final boolean isErrorEnabled() { return false; }
78  
79      /**
80       * Fatal is never enabled.
81       *
82       * @return false
83       */
84      public final boolean isFatalEnabled() { return false; }
85  
86      /**
87       * Info is never enabled.
88       *
89       * @return false
90       */
91      public final boolean isInfoEnabled() { return false; }
92  
93      /**
94       * Trace is never enabled.
95       *
96       * @return false
97       */
98      public final boolean isTraceEnabled() { return false; }
99  
100     /**
101      * Warn is never enabled.
102      *
103      * @return false
104      */
105     public final boolean isWarnEnabled() { return false; }
106 
107 }