001 /* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache license, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the license for the specific language governing permissions and 015 * limitations under the license. 016 */ 017 package org.apache.logging.log4j.core.config; 018 019 import org.apache.logging.log4j.core.Appender; 020 import org.apache.logging.log4j.core.Filter; 021 import org.apache.logging.log4j.core.LogEvent; 022 import org.apache.logging.log4j.core.Logger; 023 import org.apache.logging.log4j.core.filter.Filterable; 024 import org.apache.logging.log4j.core.lookup.StrSubstitutor; 025 026 import java.util.Map; 027 028 /** 029 * Interface that must be implemented to create a configuration. 030 */ 031 public interface Configuration extends Filterable { 032 033 /** 034 * Returns the configuration name. 035 * @return the name of the configuration. 036 */ 037 String getName(); 038 039 /** 040 * Locates the appropriate LoggerConfig for a Logger name. This will remove tokens from the 041 * package name as necessary or return the root LoggerConfig if no other matches were found. 042 * @param name The Logger name. 043 * @return The located LoggerConfig. 044 */ 045 LoggerConfig getLoggerConfig(String name); 046 047 /** 048 * Returns a Map containing all the Appenders and their name. 049 * @return A Map containing each Appender's naem and the Appender object. 050 */ 051 Map<String, Appender> getAppenders(); 052 053 Map<String, LoggerConfig> getLoggers(); 054 055 void addLoggerAppender(Logger logger, Appender appender); 056 057 void addLoggerFilter(Logger logger, Filter filter); 058 059 void setLoggerAdditive(Logger logger, boolean additive); 060 061 void start(); 062 063 void stop(); 064 065 void addListener(ConfigurationListener listener); 066 067 void removeListener(ConfigurationListener listener); 068 069 StrSubstitutor getSubst(); 070 071 void createConfiguration(Node node, LogEvent event); 072 073 Object getComponent(String name); 074 075 void addComponent(String name, Object object); 076 077 ConfigurationMonitor getConfigurationMonitor(); 078 }