View Javadoc
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.log4j.config;
18  
19  import org.apache.log4j.builders.BuilderManager;
20  import org.apache.logging.log4j.core.LoggerContext;
21  import org.apache.logging.log4j.core.config.AbstractConfiguration;
22  import org.apache.logging.log4j.core.config.Configuration;
23  import org.apache.logging.log4j.core.config.ConfigurationSource;
24  import org.apache.logging.log4j.core.config.Reconfigurable;
25  
26  /**
27   * Class Description goes here.
28   */
29  public class Log4j1Configuration extends AbstractConfiguration implements Reconfigurable {
30  
31      public static final String MONITOR_INTERVAL = "log4j1.monitorInterval";
32      public static final String APPENDER_REF_TAG = "appender-ref";
33      public static final String THRESHOLD_PARAM = "Threshold";
34  
35      public static final String INHERITED = "inherited";
36  
37      public static final String NULL = "null";
38  
39      protected final BuilderManager manager;
40  
41      public Log4j1Configuration(final LoggerContext loggerContext, final ConfigurationSource source,
42              int monitorIntervalSeconds) {
43          super(loggerContext, source);
44          manager = new BuilderManager();
45          initializeWatchers(this, source, monitorIntervalSeconds);
46      }
47  
48      public BuilderManager getBuilderManager() {
49          return manager;
50      }
51  
52      /**
53       * Initialize the configuration.
54       */
55      @Override
56      public void initialize() {
57          getStrSubstitutor().setConfiguration(this);
58          getConfigurationStrSubstitutor().setConfiguration(this);
59          super.getScheduler().start();
60          doConfigure();
61          setState(State.INITIALIZED);
62          LOGGER.debug("Configuration {} initialized", this);
63      }
64  
65      @Override
66      public Configuration reconfigure() {
67          return null;
68      }
69  }