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 * @param name logger name.
45 * @return logger.
46 */
47 public static NOPULogger getLogger(final String name) {
48 return NOP_LOGGER;
49 }
50
51 /**
52 * {@inheritDoc}
53 */
54 public boolean isDebugEnabled() {
55 return false;
56 }
57
58 /**
59 * {@inheritDoc}
60 */
61 public void debug(final Object msg) {
62 // NOP
63 }
64
65 /**
66 * {@inheritDoc}
67 */
68 public void debug(final Object parameterizedMsg, final Object param1) {
69 // NOP
70 }
71
72 /**
73 * {@inheritDoc}
74 */
75 public void debug(final String parameterizedMsg,
76 final Object param1,
77 final Object param2) {
78 // NOP
79 }
80
81 /**
82 * {@inheritDoc}
83 */
84 public void debug(final Object msg, final Throwable t) {
85 // NOP
86 }
87
88 /**
89 * {@inheritDoc}
90 */
91 public boolean isInfoEnabled() {
92 // NOP
93 return false;
94 }
95
96 /**
97 * {@inheritDoc}
98 */
99 public void info(final Object msg) {
100 // NOP
101 }
102
103 /**
104 * {@inheritDoc}
105 */
106 public void info(final Object parameterizedMsg, final Object param1) {
107 // NOP
108 }
109
110 /**
111 * {@inheritDoc}
112 */
113 public void info(final String parameterizedMsg,
114 final Object param1, final Object param2) {
115 // NOP
116 }
117
118 /**
119 * {@inheritDoc}
120 */
121 public void info(final Object msg, final Throwable t) {
122 // NOP
123 }
124
125 /**
126 * {@inheritDoc}
127 */
128 public boolean isWarnEnabled() {
129 return false;
130 }
131
132 /**
133 * {@inheritDoc}
134 */
135 public void warn(final Object msg) {
136 // NOP
137 }
138
139 /**
140 * {@inheritDoc}
141 */
142 public void warn(final Object parameterizedMsg,
143 final Object param1) {
144 // NOP
145 }
146
147 /**
148 * {@inheritDoc}
149 */
150 public void warn(final String parameterizedMsg,
151 final Object param1,
152 final Object param2) {
153 // NOP
154 }
155
156 /**
157 * {@inheritDoc}
158 */
159 public void warn(final Object msg, final Throwable t) {
160 // NOP
161 }
162
163 /**
164 * {@inheritDoc}
165 */
166 public boolean isErrorEnabled() {
167 return false;
168 }
169
170 /**
171 * {@inheritDoc}
172 */
173 public void error(final Object msg) {
174 // NOP
175 }
176
177 /**
178 * {@inheritDoc}
179 */
180 public void error(final Object parameterizedMsg, final Object param1) {
181 // NOP
182 }
183
184 /**
185 * {@inheritDoc}
186 */
187 public void error(final String parameterizedMsg,
188 final Object param1,
189 final Object param2) {
190 // NOP
191 }
192
193 /**
194 * {@inheritDoc}
195 */
196 public void error(final Object msg, final Throwable t) {
197 // NOP
198 }
199
200 }