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