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
    18  package org.apache.log4j.spi;
    19
    20  import org.apache.log4j.*;
    21  import java.util.Enumeration;
    22
    23  /***
    24     A <code>LoggerRepository</code> is used to create and retrieve
    25     <code>Loggers</code>. The relation between loggers in a repository
    26     depends on the repository but typically loggers are arranged in a
    27     named hierarchy.
    28
    29     <p>In addition to the creational methods, a
    30     <code>LoggerRepository</code> can be queried for existing loggers,
    31     can act as a point of registry for events related to loggers.
    32
    33     @author Ceki G&uuml;lc&uuml;
    34     @since 1.2 */
    35  public interface LoggerRepository {
    36
    37    /***
    38       Add a {@link HierarchyEventListener} event to the repository.
    39    */
    40    public
    41    void addHierarchyEventListener(HierarchyEventListener listener);
    42
    43    /***
    44       Returns whether this repository is disabled for a given
    45       level. The answer depends on the repository threshold and the
    46       <code>level</code> parameter. See also {@link #setThreshold}
    47       method.  */
    48    boolean isDisabled(int level);
    49
    50    /***
    51       Set the repository-wide threshold. All logging requests below the
    52       threshold are immediately dropped. By default, the threshold is
    53       set to <code>Level.ALL</code> which has the lowest possible rank.  */
    54    public
    55    void setThreshold(Level level);
    56
    57    /***
    58        Another form of {@link #setThreshold(Level)} accepting a string
    59        parameter instead of a <code>Level</code>. */
    60    public
    61    void setThreshold(String val);
    62
    63    public
    64    void emitNoAppenderWarning(Category cat);
    65
    66    /***
    67       Get the repository-wide threshold. See {@link
    68       #setThreshold(Level)} for an explanation. */
    69    public
    70    Level getThreshold();
    71
    72    public
    73    Logger getLogger(String name);
    74
    75    public
    76    Logger getLogger(String name, LoggerFactory factory);
    77
    78    public
    79    Logger getRootLogger();
    80
    81    public
    82    abstract
    83    Logger exists(String name);
    84
    85    public
    86    abstract
    87    void shutdown();
    88
    89    public
    90    Enumeration getCurrentLoggers();
    91
    92    /***
    93       Deprecated. Please use {@link #getCurrentLoggers} instead.  */
    94    public
    95    Enumeration getCurrentCategories();
    96
    97
    98    public
    99    abstract
    100   void fireAddAppenderEvent(Category logger, Appender appender);
    101
    102   public
    103   abstract
    104   void resetConfiguration();
    105
    106 }