KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > log4j > spi > LoggerRepository


1 /*
2  * Copyright 1999-2005 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.apache.log4j.spi;
18
19 import org.apache.log4j.*;
20 import java.util.Enumeration JavaDoc;
21
22 /**
23    A <code>LoggerRepository</code> is used to create and retrieve
24    <code>Loggers</code>. The relation between loggers in a repository
25    depends on the repository but typically loggers are arranged in a
26    named hierarchy.
27
28    <p>In addition to the creational methods, a
29    <code>LoggerRepository</code> can be queried for existing loggers,
30    can act as a point of registry for events related to loggers.
31
32    @author Ceki G&uuml;lc&uuml;
33    @since 1.2 */

34 public interface LoggerRepository {
35
36   /**
37      Add a {@link HierarchyEventListener} event to the repository.
38   */

39   public
40   void addHierarchyEventListener(HierarchyEventListener listener);
41
42   /**
43      Returns whether this repository is disabled for a given
44      level. The answer depends on the repository threshold and the
45      <code>level</code> parameter. See also {@link #setThreshold}
46      method. */

47   boolean isDisabled(int level);
48
49   /**
50      Set the repository-wide threshold. All logging requests below the
51      threshold are immediately dropped. By default, the threshold is
52      set to <code>Level.ALL</code> which has the lowest possible rank. */

53   public
54   void setThreshold(Level level);
55
56   /**
57       Another form of {@link #setThreshold(Level)} accepting a string
58       parameter instead of a <code>Level</code>. */

59   public
60   void setThreshold(String JavaDoc val);
61
62   public
63   void emitNoAppenderWarning(Category cat);
64
65   /**
66      Get the repository-wide threshold. See {@link
67      #setThreshold(Level)} for an explanation. */

68   public
69   Level getThreshold();
70
71   public
72   Logger getLogger(String JavaDoc name);
73
74   public
75   Logger getLogger(String JavaDoc name, LoggerFactory factory);
76
77   public
78   Logger getRootLogger();
79
80   public
81   abstract
82   Logger exists(String JavaDoc name);
83
84   public
85   abstract
86   void shutdown();
87
88   public
89   Enumeration JavaDoc getCurrentLoggers();
90
91   /**
92      @deprecated Please use {@link #getCurrentLoggers} instead. */

93   public
94   Enumeration JavaDoc getCurrentCategories();
95
96
97   public
98   abstract
99   void fireAddAppenderEvent(Category logger, Appender appender);
100
101   public
102   abstract
103   void resetConfiguration();
104
105 }
106
Popular Tags