View Javadoc

    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.impl;
    18
    19  import java.io.Serializable;
    20  import org.apache.commons.logging.Log;
    21
    22  /**
    23   * <p>
    24   * Trivial implementation of Log that throws away all messages. No configurable
    25   * system properties are supported.
    26   * </p>
    27   *
    28   * @author <a href="mailto:sanders@apache.org">Scott Sanders</a>
    29   * @author Rod Waldhoff
    30   * @version $Id: NoOpLog.java,v 1.8 2004/06/06 21:13:12 rdonkin Exp $
    31   */
    32  public class NoOpLog implements Log, Serializable {
    33      private static final long serialVersionUID = 561423906191706148L;
    34
    35      /** Convenience constructor */
    36      public NoOpLog() {
    37      }
    38
    39      /** Base constructor */
    40      public NoOpLog(String name) {
    41      }
    42
    43      /** Do nothing */
    44      public void trace(Object message) {
    45      }
    46
    47      /** Do nothing */
    48      public void trace(Object message, Throwable t) {
    49      }
    50
    51      /** Do nothing */
    52      public void debug(Object message) {
    53      }
    54
    55      /** Do nothing */
    56      public void debug(Object message, Throwable t) {
    57      }
    58
    59      /** Do nothing */
    60      public void info(Object message) {
    61      }
    62
    63      /** Do nothing */
    64      public void info(Object message, Throwable t) {
    65      }
    66
    67      /** Do nothing */
    68      public void warn(Object message) {
    69      }
    70
    71      /** Do nothing */
    72      public void warn(Object message, Throwable t) {
    73      }
    74
    75      /** Do nothing */
    76      public void error(Object message) {
    77      }
    78
    79      /** Do nothing */
    80      public void error(Object message, Throwable t) {
    81      }
    82
    83      /** Do nothing */
    84      public void fatal(Object message) {
    85      }
    86
    87      /** Do nothing */
    88      public void fatal(Object message, Throwable t) {
    89      }
    90
    91      /**
    92       * Debug is never enabled.
    93       *
    94       * @return false
    95       */
    96      public final boolean isDebugEnabled() {
    97          return false;
    98      }
    99
    100     /**
    101      * Error is never enabled.
    102      *
    103      * @return false
    104      */
    105     public final boolean isErrorEnabled() {
    106         return false;
    107     }
    108
    109     /**
    110      * Fatal is never enabled.
    111      *
    112      * @return false
    113      */
    114     public final boolean isFatalEnabled() {
    115         return false;
    116     }
    117
    118     /**
    119      * Info is never enabled.
    120      *
    121      * @return false
    122      */
    123     public final boolean isInfoEnabled() {
    124         return false;
    125     }
    126
    127     /**
    128      * Trace is never enabled.
    129      *
    130      * @return false
    131      */
    132     public final boolean isTraceEnabled() {
    133         return false;
    134     }
    135
    136     /**
    137      * Warn is never enabled.
    138      *
    139      * @return false
    140      */
    141     public final boolean isWarnEnabled() {
    142         return false;
    143     }
    144
    145 }