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.jmx;
018    
019    /**
020     * The MBean interface for monitoring and managing a {@code LoggerConfig}.
021     */
022    public interface LoggerConfigAdminMBean {
023        /** ObjectName pattern for LoggerConfigAdmin MBeans. */
024        String PATTERN = "org.apache.logging.log4j2:type=LoggerContext,ctx=%s,sub=LoggerConfig,name=%s";
025    
026        /**
027         * Returns the name of the instrumented {@code LoggerConfig}.
028         * 
029         * @return the name of the LoggerConfig
030         */
031        String getName();
032    
033        /**
034         * Returns the {@code LoggerConfig} level as a String.
035         * 
036         * @return the {@code LoggerConfig} level.
037         */
038        String getLevel();
039    
040        /**
041         * Sets the {@code LoggerConfig} level to the specified value.
042         * 
043         * @param level the new {@code LoggerConfig} level.
044         * @throws IllegalArgumentException if the specified level is not one of
045         *             "OFF", "FATAL", "ERROR", "WARN", "INFO", "DEBUG", "TRACE",
046         *             "ALL"
047         */
048        void setLevel(String level);
049    
050        /**
051         * Returns whether the instrumented {@code LoggerConfig} is additive.
052         * 
053         * @return {@code true} if the LoggerConfig is additive, {@code false}
054         *         otherwise
055         */
056        boolean isAdditive();
057    
058        /**
059         * Sets whether the instrumented {@code LoggerConfig} should be additive.
060         * 
061         * @param additive {@code true} if the instrumented LoggerConfig should be
062         *            additive, {@code false} otherwise
063         */
064        void setAdditive(boolean additive);
065    
066        /**
067         * Returns whether the instrumented {@code LoggerConfig} is configured to
068         * include location.
069         * 
070         * @return whether location should be passed downstream
071         */
072        boolean isIncludeLocation();
073    
074        /**
075         * Returns a string description of all filters configured for the
076         * instrumented {@code LoggerConfig}.
077         * 
078         * @return a string description of all configured filters for this
079         *         LoggerConfig
080         */
081        String getFilter();
082    
083        /**
084         * Returns a String array with the appender refs configured for the
085         * instrumented {@code LoggerConfig}.
086         * 
087         * @return the appender refs for the instrumented {@code LoggerConfig}.
088         */
089        String[] getAppenderRefs();
090    
091    }