Source code

    001/*
    002 * Copyright 2001-2004 The Apache Software Foundation.
    003 *
    004 * Licensed under the Apache License, Version 2.0 (the "License");
    005 * you may not use this file except in compliance with the License.
    006 * You may obtain a copy of the License at
    007 *
    008 *      http://www.apache.org/licenses/LICENSE-2.0
    009 *
    010 * Unless required by applicable law or agreed to in writing, software
    011 * distributed under the License is distributed on an "AS IS" BASIS,
    012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    013 * See the License for the specific language governing permissions and
    014 * limitations under the License.
    015 */
    016
    017package org.apache.commons.logging.impl;
    018
    019import java.io.Serializable;
    020import org.apache.commons.logging.Log;
    021
    022/**
    023 * <p>
    024 * Trivial implementation of Log that throws away all messages. No configurable
    025 * system properties are supported.
    026 * </p>
    027 *
    028 * @author <a href="mailto:sanders@apache.org">Scott Sanders</a>
    029 * @author Rod Waldhoff
    030 * @version $Id: NoOpLog.java,v 1.8 2004/06/06 21:13:12 rdonkin Exp $
    031 */
    032public class NoOpLog implements Log, Serializable {
    033    private static final long serialVersionUID = 561423906191706148L;
    034
    035    /** Convenience constructor */
    036    public NoOpLog() {
    037    }
    038
    039    /** Base constructor */
    040    public NoOpLog(String name) {
    041    }
    042
    043    /** Do nothing */
    044    public void trace(Object message) {
    045    }
    046
    047    /** Do nothing */
    048    public void trace(Object message, Throwable t) {
    049    }
    050
    051    /** Do nothing */
    052    public void debug(Object message) {
    053    }
    054
    055    /** Do nothing */
    056    public void debug(Object message, Throwable t) {
    057    }
    058
    059    /** Do nothing */
    060    public void info(Object message) {
    061    }
    062
    063    /** Do nothing */
    064    public void info(Object message, Throwable t) {
    065    }
    066
    067    /** Do nothing */
    068    public void warn(Object message) {
    069    }
    070
    071    /** Do nothing */
    072    public void warn(Object message, Throwable t) {
    073    }
    074
    075    /** Do nothing */
    076    public void error(Object message) {
    077    }
    078
    079    /** Do nothing */
    080    public void error(Object message, Throwable t) {
    081    }
    082
    083    /** Do nothing */
    084    public void fatal(Object message) {
    085    }
    086
    087    /** Do nothing */
    088    public void fatal(Object message, Throwable t) {
    089    }
    090
    091    /**
    092     * Debug is never enabled.
    093     *
    094     * @return false
    095     */
    096    public final boolean isDebugEnabled() {
    097        return false;
    098    }
    099
    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}