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.jmx;
18
19 /**
20 * The MBean interface for monitoring and managing a {@code LoggerConfig}.
21 */
22 public interface LoggerConfigAdminMBean {
23 /** ObjectName pattern for LoggerConfigAdmin MBeans. */
24 String PATTERN = "org.apache.logging.log4j2:type=LoggerContext,ctx=%s,sub=LoggerConfig,name=%s";
25
26 /**
27 * Returns the name of the instrumented {@code LoggerConfig}.
28 *
29 * @return the name of the LoggerConfig
30 */
31 String getName();
32
33 /**
34 * Returns the {@code LoggerConfig} level as a String.
35 *
36 * @return the {@code LoggerConfig} level.
37 */
38 String getLevel();
39
40 /**
41 * Sets the {@code LoggerConfig} level to the specified value.
42 *
43 * @param level the new {@code LoggerConfig} level.
44 * @throws IllegalArgumentException if the specified level is not one of
45 * "OFF", "FATAL", "ERROR", "WARN", "INFO", "DEBUG", "TRACE",
46 * "ALL"
47 */
48 void setLevel(String level);
49
50 /**
51 * Returns whether the instrumented {@code LoggerConfig} is additive.
52 *
53 * @return {@code true} if the LoggerConfig is additive, {@code false}
54 * otherwise
55 */
56 boolean isAdditive();
57
58 /**
59 * Sets whether the instrumented {@code LoggerConfig} should be additive.
60 *
61 * @param additive {@code true} if the instrumented LoggerConfig should be
62 * additive, {@code false} otherwise
63 */
64 void setAdditive(boolean additive);
65
66 /**
67 * Returns whether the instrumented {@code LoggerConfig} is configured to
68 * include location.
69 *
70 * @return whether location should be passed downstream
71 */
72 boolean isIncludeLocation();
73
74 /**
75 * Returns a string description of all filters configured for the
76 * instrumented {@code LoggerConfig}.
77 *
78 * @return a string description of all configured filters for this
79 * LoggerConfig
80 */
81 String getFilter();
82
83 /**
84 * Returns a String array with the appender refs configured for the
85 * instrumented {@code LoggerConfig}.
86 *
87 * @return the appender refs for the instrumented {@code LoggerConfig}.
88 */
89 String[] getAppenderRefs();
90
91 }