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.logging.log4j.core.config; 18 19 import org.apache.logging.log4j.core.Appender; 20 import org.apache.logging.log4j.core.Filter; 21 import org.apache.logging.log4j.core.LogEvent; 22 import org.apache.logging.log4j.core.Logger; 23 import org.apache.logging.log4j.core.filter.Filterable; 24 import org.apache.logging.log4j.core.lookup.StrSubstitutor; 25 26 import java.util.Map; 27 28 /** 29 * Interface that must be implemented to create a configuration. 30 */ 31 public interface Configuration extends Filterable { 32 33 /** 34 * Returns the configuration name. 35 * @return the name of the configuration. 36 */ 37 String getName(); 38 39 /** 40 * Locates the appropriate LoggerConfig for a Logger name. This will remove tokens from the 41 * package name as necessary or return the root LoggerConfig if no other matches were found. 42 * @param name The Logger name. 43 * @return The located LoggerConfig. 44 */ 45 LoggerConfig getLoggerConfig(String name); 46 47 /** 48 * Returns a Map containing all the Appenders and their name. 49 * @return A Map containing each Appender's naem and the Appender object. 50 */ 51 Map<String, Appender> getAppenders(); 52 53 Map<String, LoggerConfig> getLoggers(); 54 55 void addLoggerAppender(Logger logger, Appender appender); 56 57 void addLoggerFilter(Logger logger, Filter filter); 58 59 void setLoggerAdditive(Logger logger, boolean additive); 60 61 void start(); 62 63 void stop(); 64 65 void addListener(ConfigurationListener listener); 66 67 void removeListener(ConfigurationListener listener); 68 69 StrSubstitutor getSubst(); 70 71 void createConfiguration(Node node, LogEvent event); 72 73 Object getComponent(String name); 74 75 void addComponent(String name, Object object); 76 77 ConfigurationMonitor getConfigurationMonitor(); 78 }