blob: 62eb364fe972156dae7ebe298f7951edd3c224f7 [file] [log] [blame]
/*
* ============================================================================
* The Apache Software License, Version 1.1
* ============================================================================
*
* Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. The end-user documentation included with the redistribution, if any, must
* include the following acknowledgment: "This product includes software
* developed by the Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself, if
* and wherever such third-party acknowledgments normally appear.
*
* 4. The names "log4j" and "Apache Software Foundation" must not be used to
* endorse or promote products derived from this software without prior
* written permission. For written permission, please contact
* apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache", nor may
* "Apache" appear in their name, without prior written permission of the
* Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
* DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* on behalf of the Apache Software Foundation. For more information on the
* Apache Software Foundation, please see <http://www.apache.org/>.
*
*/
package org.apache.log4j.spi;
import org.apache.log4j.*;
import java.util.Enumeration;
/**
A <code>LoggerRepository</code> is used to create and retrieve
<code>Loggers</code>. The relation between loggers in a repository
depends on the repository but typically loggers are arranged in a
named hierarchy.
<p>In addition to the creational methods, a
<code>LoggerRepository</code> can be queried for existing loggers,
can act as a point of registry for events related to loggers.
@author Ceki G&uuml;lc&uuml;
@author Mark Womack
@since 1.2 */
public interface LoggerRepository {
/**
Add a {@link LoggerRepositoryEventListener} to the repository. The
listener will be called when repository events occur.
@since 1.3*/
public void addLoggerRepositoryEventListener(
LoggerRepositoryEventListener listener);
/**
Remove a {@link LoggerRepositoryEventListener} from the repository.
@since 1.3*/
public void removeLoggerRepositoryEventListener(
LoggerRepositoryEventListener listener);
/**
Add a {@link LoggerEventListener} to the repository. The listener
will be called when repository events occur.
@since 1.3*/
public void addLoggerEventListener(LoggerEventListener listener);
/**
Remove a {@link LoggerEventListener} from the repository.
@since 1.3*/
public void removeLoggerEventListener(LoggerEventListener listener);
/**
Is the repository disabled for a given level? The answer depends
on the repository threshold and the <code>level</code>
parameter. See also {@link #setThreshold} method. */
boolean isDisabled(int level);
/**
Set the repository-wide threshold. All logging requests below the
threshold are immediately dropped. By default, the threshold is
set to <code>Level.ALL</code> which has the lowest possible rank. */
public void setThreshold(Level level);
/**
Another form of {@link #setThreshold(Level)} accepting a string
parameter instead of a <code>Level</code>. */
public void setThreshold(String val);
public void emitNoAppenderWarning(Category cat);
/**
Get the repository-wide threshold. See {@link
#setThreshold(Level)} for an explanation. */
public Level getThreshold();
public Logger getLogger(String name);
public Logger getLogger(String name, LoggerFactory factory);
public Logger getRootLogger();
public abstract Logger exists(String name);
public abstract void shutdown();
public Enumeration getCurrentLoggers();
/**
@deprecated Please use {@link #getCurrentLoggers} instead. */
public Enumeration getCurrentCategories();
public abstract void resetConfiguration();
/**
Requests that a appender added event be sent to any registered
{@link LoggerEventListener}.
@param logger The logger to which the appender was added.
@param appender The appender added to the logger.
@since 1.3*/
public abstract void fireAddAppenderEvent(Logger logger, Appender appender);
/**
Requests that a appender removed event be sent to any registered
{@link LoggerEventListener}.
@param logger The logger from which the appender was removed.
@param appender The appender removed from the logger.
@since 1.3*/
public abstract void fireRemoveAppenderEvent(
Logger logger, Appender appender);
/**
Requests that a level changed event be sent to any registered
{@link LoggerEventListener}.
@param logger The logger which changed levels.
@since 1.3*/
public abstract void fireLevelChangedEvent(Logger logger);
/**
Requests that a configuration changed event be sent to any registered
{@link LoggerRepositoryEventListener}.
@param logger The logger which changed levels.
@since 1.3*/
public abstract void fireConfigurationChangedEvent();
}