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 */
017package org.apache.log4j.spi;
018
019import org.apache.log4j.Appender;
020import org.apache.log4j.Level;
021import org.apache.log4j.Logger;
022import org.apache.log4j.Priority;
023
024import java.util.Enumeration;
025import java.util.ResourceBundle;
026import java.util.Vector;
027
028/**
029 * No-operation implementation of Logger used by NOPLoggerRepository.
030 * @since 1.2.15
031 */
032public final class NOPLogger extends Logger {
033    /**
034     * Create instance of Logger.
035     * @param repo repository, may not be null.
036     * @param name name, may not be null, use "root" for root logger.
037     */
038    public NOPLogger(NOPLoggerRepository repo, final String name) {
039        super(name);
040        this.repository = repo;
041        this.level = Level.OFF;
042        this.parent = this;
043    }
044
045    /** {@inheritDoc} */
046    public void addAppender(final Appender newAppender) {
047    }
048
049    /** {@inheritDoc} */
050    public void assertLog(final boolean assertion, final String msg) {
051    }
052
053
054    /** {@inheritDoc} */
055    public void callAppenders(final LoggingEvent event) {
056    }
057
058    /** {@inheritDoc} */
059    void closeNestedAppenders() {
060    }
061
062    /** {@inheritDoc} */
063    public void debug(final Object message) {
064    }
065
066
067    /** {@inheritDoc} */
068    public void debug(final Object message, final Throwable t) {
069    }
070
071    /** {@inheritDoc} */
072    public void error(final Object message) {
073    }
074
075    /** {@inheritDoc} */
076    public void error(final Object message, final Throwable t) {
077    }
078
079
080    /** {@inheritDoc} */
081    public void fatal(final Object message) {
082    }
083
084    /** {@inheritDoc} */
085    public void fatal(final Object message, final Throwable t) {
086    }
087
088
089    /** {@inheritDoc} */
090    public Enumeration getAllAppenders() {
091      return new Vector().elements();
092    }
093
094    /** {@inheritDoc} */
095    public Appender getAppender(final String name) {
096       return null;
097    }
098
099    /** {@inheritDoc} */
100    public Level getEffectiveLevel() {
101      return Level.OFF;
102    }
103
104    /** {@inheritDoc} */
105    public Priority getChainedPriority() {
106      return getEffectiveLevel();
107    }
108
109    /** {@inheritDoc} */
110    public ResourceBundle getResourceBundle() {
111      return null;
112    }
113
114
115    /** {@inheritDoc} */
116    public void info(final Object message) {
117    }
118
119    /** {@inheritDoc} */
120    public void info(final Object message, final Throwable t) {
121    }
122
123    /** {@inheritDoc} */
124    public boolean isAttached(Appender appender) {
125      return false;
126    }
127
128    /** {@inheritDoc} */
129    public boolean isDebugEnabled() {
130      return false;
131    }
132
133    /** {@inheritDoc} */
134    public boolean isEnabledFor(final Priority level) {
135      return false;
136    }
137
138    /** {@inheritDoc} */
139    public boolean isInfoEnabled() {
140      return false;
141    }
142
143
144    /** {@inheritDoc} */
145    public void l7dlog(final Priority priority, final String key, final Throwable t) {
146    }
147
148    /** {@inheritDoc} */
149    public void l7dlog(final Priority priority, final String key,  final Object[] params, final Throwable t) {
150    }
151
152    /** {@inheritDoc} */
153    public void log(final Priority priority, final Object message, final Throwable t) {
154    }
155
156    /** {@inheritDoc} */
157    public void log(final Priority priority, final Object message) {
158    }
159
160    /** {@inheritDoc} */
161    public void log(final String callerFQCN, final Priority level, final Object message, final Throwable t) {
162    }
163
164    /** {@inheritDoc} */
165    public void removeAllAppenders() {
166    }
167
168
169    /** {@inheritDoc} */
170    public void removeAppender(Appender appender) {
171    }
172
173    /** {@inheritDoc} */
174    public void removeAppender(final String name) {
175    }
176
177    /** {@inheritDoc} */
178    public void setLevel(final Level level) {
179    }
180
181
182    /** {@inheritDoc} */
183    public void setPriority(final Priority priority) {
184    }
185
186    /** {@inheritDoc} */
187    public void setResourceBundle(final ResourceBundle bundle) {
188    }
189
190    /** {@inheritDoc} */
191    public void warn(final Object message) {
192    }
193
194    /** {@inheritDoc} */
195    public void warn(final Object message, final Throwable t) {
196    }
197
198    /** {@inheritDoc} */
199    public void trace(Object message) {
200    }
201
202    /** {@inheritDoc} */
203    public void trace(Object message, Throwable t) {
204    }
205
206    /** {@inheritDoc} */
207    public boolean isTraceEnabled() {
208        return false;
209    }
210
211
212}