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 /** Key for storing the Context properties. */ 034 String CONTEXT_PROPERTIES = "ContextProperties"; 035 036 /** 037 * Returns the configuration name. 038 * @return the name of the configuration. 039 */ 040 String getName(); 041 042 /** 043 * Locates the appropriate LoggerConfig for a Logger name. This will remove tokens from the 044 * package name as necessary or return the root LoggerConfig if no other matches were found. 045 * @param name The Logger name. 046 * @return The located LoggerConfig. 047 */ 048 LoggerConfig getLoggerConfig(String name); 049 050 /** 051 * Returns a Map containing all the Appenders and their name. 052 * @return A Map containing each Appender's name and the Appender object. 053 */ 054 Map<String, Appender<?>> getAppenders(); 055 056 Map<String, LoggerConfig> getLoggers(); 057 058 void addLoggerAppender(Logger logger, Appender<?> appender); 059 060 void addLoggerFilter(Logger logger, Filter filter); 061 062 void setLoggerAdditive(Logger logger, boolean additive); 063 064 Map<String, String> getProperties(); 065 066 void start(); 067 068 void stop(); 069 070 void addListener(ConfigurationListener listener); 071 072 void removeListener(ConfigurationListener listener); 073 074 StrSubstitutor getSubst(); 075 076 void createConfiguration(Node node, LogEvent event); 077 078 Object getComponent(String name); 079 080 void addComponent(String name, Object object); 081 082 ConfigurationMonitor getConfigurationMonitor(); 083 }