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
018 package org.apache.commons.logging.impl;
019
020 import java.io.Serializable;
021 import org.apache.commons.logging.Log;
022
023 /**
024 * Trivial implementation of Log that throws away all messages. No
025 * configurable system properties are supported.
026 *
027 * @version $Id: NoOpLog.html 862526 2013-05-20 17:07:42Z tn $
028 */
029 public class NoOpLog implements Log, Serializable {
030
031 /** Serializable version identifier. */
032 private static final long serialVersionUID = 561423906191706148L;
033
034 /** Convenience constructor */
035 public NoOpLog() { }
036 /** Base constructor */
037 public NoOpLog(String name) { }
038 /** Do nothing */
039 public void trace(Object message) { }
040 /** Do nothing */
041 public void trace(Object message, Throwable t) { }
042 /** Do nothing */
043 public void debug(Object message) { }
044 /** Do nothing */
045 public void debug(Object message, Throwable t) { }
046 /** Do nothing */
047 public void info(Object message) { }
048 /** Do nothing */
049 public void info(Object message, Throwable t) { }
050 /** Do nothing */
051 public void warn(Object message) { }
052 /** Do nothing */
053 public void warn(Object message, Throwable t) { }
054 /** Do nothing */
055 public void error(Object message) { }
056 /** Do nothing */
057 public void error(Object message, Throwable t) { }
058 /** Do nothing */
059 public void fatal(Object message) { }
060 /** Do nothing */
061 public void fatal(Object message, Throwable t) { }
062
063 /**
064 * Debug is never enabled.
065 *
066 * @return false
067 */
068 public final boolean isDebugEnabled() { return false; }
069
070 /**
071 * Error is never enabled.
072 *
073 * @return false
074 */
075 public final boolean isErrorEnabled() { return false; }
076
077 /**
078 * Fatal is never enabled.
079 *
080 * @return false
081 */
082 public final boolean isFatalEnabled() { return false; }
083
084 /**
085 * Info is never enabled.
086 *
087 * @return false
088 */
089 public final boolean isInfoEnabled() { return false; }
090
091 /**
092 * Trace is never enabled.
093 *
094 * @return false
095 */
096 public final boolean isTraceEnabled() { return false; }
097
098 /**
099 * Warn is never enabled.
100 *
101 * @return false
102 */
103 public final boolean isWarnEnabled() { return false; }
104 }