bdb6ed9cd80891c08d414c0c779a286fa7fd6e55
[jalview.git] / srcjar2 / org / apache / log4j / spi / NOPLoggerRepository.java
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.Level;
20 import org.apache.log4j.Category;
21 import org.apache.log4j.Logger;
22 import org.apache.log4j.Appender;
23
24 import java.util.Enumeration;
25 import java.util.Vector;
26
27 /**
28  *  No-operation implementation of LoggerRepository which is used when
29  *  LogManager.repositorySelector is erroneously nulled during class reloading.
30  *  @since 1.2.15
31  */
32 public final class NOPLoggerRepository implements LoggerRepository {
33     /**
34      * {@inheritDoc}
35     */
36     public void addHierarchyEventListener(final HierarchyEventListener listener) {
37     }
38
39     /**
40      * {@inheritDoc}
41      */
42     public boolean isDisabled(final int level) {
43         return true;
44     }
45
46     /**
47      * {@inheritDoc}
48      */
49     public void setThreshold(final Level level) {
50     }
51
52     /**
53      * {@inheritDoc}
54      */
55     public void setThreshold(final String val) {
56     }
57
58     /**
59      * {@inheritDoc}
60      */
61     public void emitNoAppenderWarning(final Category cat) {
62     }
63
64     /**
65      * {@inheritDoc}
66      */
67     public Level getThreshold() {
68         return Level.OFF;
69     }
70
71     /**
72      * {@inheritDoc}
73      */
74     public Logger getLogger(final String name) {
75         return new NOPLogger(this, name);
76     }
77
78     /**
79      * {@inheritDoc}
80      */
81     public Logger getLogger(final String name, final LoggerFactory factory) {
82         return new NOPLogger(this, name);
83     }
84
85     /**
86      * {@inheritDoc}
87      */
88     public Logger getRootLogger() {
89         return new NOPLogger(this, "root");
90     }
91
92     /**
93      * {@inheritDoc}
94      */
95     public Logger exists(final String name) {
96         return null;
97     }
98
99     /**
100      * {@inheritDoc}
101      */
102     public void shutdown() {
103     }
104
105     /**
106      * {@inheritDoc}
107      */
108     public Enumeration getCurrentLoggers() {
109         return new Vector().elements();
110     }
111
112     /**
113      * {@inheritDoc}
114      */
115     public Enumeration getCurrentCategories() {
116         return getCurrentLoggers();
117     }
118
119
120     /**
121      * {@inheritDoc}
122      */
123     public  void fireAddAppenderEvent(Category logger, Appender appender) {
124     }
125
126     /**
127      * {@inheritDoc}
128      */
129     public void resetConfiguration() {
130     }
131 }