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.logging.log4j.core.selector;
18  
19  import java.net.URI;
20  import java.util.List;
21  
22  import org.apache.logging.log4j.core.LoggerContext;
23  
24  /**
25   * Interface used to locate a LoggerContext.
26   */
27  public interface ContextSelector {
28  
29      /**
30       * Returns the LoggerContext.
31       * @param fqcn The fully qualified class name of the caller.
32       * @param loader ClassLoader to use or null.
33       * @param currentContext If true returns the current Context, if false returns the Context appropriate
34       * for the caller if a more appropriate Context can be determined.
35       * @return The LoggerContext.
36       */
37      LoggerContext getContext(String fqcn, ClassLoader loader, boolean currentContext);
38  
39      /**
40       * Returns the LoggerContext.
41       * @param fqcn The fully qualified class name of the caller.
42       * @param loader ClassLoader to use or null.
43       * @param currentContext If true returns the current Context, if false returns the Context appropriate
44       * for the caller if a more appropriate Context can be determined.
45       * @param configLocation The location of the configuration for the LoggerContext.
46       * @return The LoggerContext.
47       */
48      LoggerContext getContext(String fqcn, ClassLoader loader, boolean currentContext, URI configLocation);
49  
50      /**
51       * Returns a List of all the available LoggerContexts.
52       * @return The List of LoggerContexts.
53       */
54      List<LoggerContext> getLoggerContexts();
55  
56      /**
57       * Remove any references to the LoggerContext.
58       * @param context The context to remove.
59       */
60      void removeContext(LoggerContext context);
61  }