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  package org.apache.log4j.spi;
18  
19  import org.apache.log4j.ULogger;
20  
21  
22  /**
23   * A no operation (NOP) implementation of {@link ULogger}.
24   *
25   * @author Ceki Gülcü
26   */
27  public final class NOPULogger implements ULogger {
28  
29      /**
30       * The unique instance of NOPLogger.
31       */
32      public static final NOPULogger NOP_LOGGER = new NOPULogger();
33  
34      /**
35       * There is no point in people creating multiple instances of NullLogger.
36       * Hence, the private access modifier.
37       */
38      private NOPULogger() {
39          super();
40      }
41  
42      /**
43       * Get instance.
44       *
45       * @param name logger name.
46       * @return logger.
47       */
48      public static NOPULogger getLogger(final String name) {
49          return NOP_LOGGER;
50      }
51  
52      /**
53       * {@inheritDoc}
54       */
55      public boolean isDebugEnabled() {
56          return false;
57      }
58  
59      /**
60       * {@inheritDoc}
61       */
62      public void debug(final Object msg) {
63          // NOP
64      }
65  
66      /**
67       * {@inheritDoc}
68       */
69      public void debug(final Object parameterizedMsg, final Object param1) {
70          // NOP
71      }
72  
73      /**
74       * {@inheritDoc}
75       */
76      public void debug(final String parameterizedMsg,
77                        final Object param1,
78                        final Object param2) {
79          // NOP
80      }
81  
82      /**
83       * {@inheritDoc}
84       */
85      public void debug(final Object msg, final Throwable t) {
86          // NOP
87      }
88  
89      /**
90       * {@inheritDoc}
91       */
92      public boolean isInfoEnabled() {
93          // NOP
94          return false;
95      }
96  
97      /**
98       * {@inheritDoc}
99       */
100     public void info(final Object msg) {
101         // NOP
102     }
103 
104     /**
105      * {@inheritDoc}
106      */
107     public void info(final Object parameterizedMsg, final Object param1) {
108         // NOP
109     }
110 
111     /**
112      * {@inheritDoc}
113      */
114     public void info(final String parameterizedMsg,
115                      final Object param1, final Object param2) {
116         // NOP
117     }
118 
119     /**
120      * {@inheritDoc}
121      */
122     public void info(final Object msg, final Throwable t) {
123         // NOP
124     }
125 
126     /**
127      * {@inheritDoc}
128      */
129     public boolean isWarnEnabled() {
130         return false;
131     }
132 
133     /**
134      * {@inheritDoc}
135      */
136     public void warn(final Object msg) {
137         // NOP
138     }
139 
140     /**
141      * {@inheritDoc}
142      */
143     public void warn(final Object parameterizedMsg,
144                      final Object param1) {
145         // NOP
146     }
147 
148     /**
149      * {@inheritDoc}
150      */
151     public void warn(final String parameterizedMsg,
152                      final Object param1,
153                      final Object param2) {
154         // NOP
155     }
156 
157     /**
158      * {@inheritDoc}
159      */
160     public void warn(final Object msg, final Throwable t) {
161         // NOP
162     }
163 
164     /**
165      * {@inheritDoc}
166      */
167     public boolean isErrorEnabled() {
168         return false;
169     }
170 
171     /**
172      * {@inheritDoc}
173      */
174     public void error(final Object msg) {
175         // NOP
176     }
177 
178     /**
179      * {@inheritDoc}
180      */
181     public void error(final Object parameterizedMsg, final Object param1) {
182         // NOP
183     }
184 
185     /**
186      * {@inheritDoc}
187      */
188     public void error(final String parameterizedMsg,
189                       final Object param1,
190                       final Object param2) {
191         // NOP
192     }
193 
194     /**
195      * {@inheritDoc}
196      */
197     public void error(final Object msg, final Throwable t) {
198         // NOP
199     }
200 
201 }