Path: blob/master/src/java.logging/share/classes/java/util/logging/LoggingMXBean.java
41159 views
/*1* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package java.util.logging;262728/**29* The management interface for the logging facility.30*31* {@link java.lang.management.PlatformLoggingMXBean32* java.lang.management.PlatformLoggingMXBean} is the management interface33* for logging facility registered in the {@link34* java.lang.management.ManagementFactory#getPlatformMBeanServer()35* platform MBeanServer}.36* It is recommended to use the {@code PlatformLoggingMXBean} obtained via37* the {@link java.lang.management.ManagementFactory#getPlatformMXBean(Class)38* ManagementFactory.getPlatformMXBean(PlatformLoggingMXBean.class)} method.39*40* @deprecated {@code LoggingMXBean} is no longer a {@link41* java.lang.management.PlatformManagedObject platform MXBean} and is replaced42* with {@link java.lang.management.PlatformLoggingMXBean}.43* It will not register in the platform {@code MBeanServer}.44* Use {@code ManagementFactory.getPlatformMXBean(PlatformLoggingMXBean.class)}45* instead.46*47* @author Ron Mann48* @author Mandy Chung49* @since 1.550*51* @see java.lang.management.PlatformLoggingMXBean52*/53@Deprecated(since="9")54public interface LoggingMXBean {5556/**57* Returns the list of currently registered logger names. This method58* calls {@link LogManager#getLoggerNames} and returns a list59* of the logger names.60*61* @return A list of {@code String} each of which is a62* currently registered {@code Logger} name.63*/64public java.util.List<String> getLoggerNames();6566/**67* Gets the name of the log level associated with the specified logger.68* If the specified logger does not exist, {@code null}69* is returned.70* This method first finds the logger of the given name and71* then returns the name of the log level by calling:72* <blockquote>73* {@link Logger#getLevel Logger.getLevel()}.{@link Level#getName getName()};74* </blockquote>75*76* <p>77* If the {@code Level} of the specified logger is {@code null},78* which means that this logger's effective level is inherited79* from its parent, an empty string will be returned.80*81* @param loggerName The name of the {@code Logger} to be retrieved.82*83* @return The name of the log level of the specified logger; or84* an empty string if the log level of the specified logger85* is {@code null}. If the specified logger does not86* exist, {@code null} is returned.87*88* @see Logger#getLevel89*/90public String getLoggerLevel(String loggerName);9192/**93* Sets the specified logger to the specified new level.94* If the {@code levelName} is not {@code null}, the level95* of the specified logger is set to the parsed {@code Level}96* matching the {@code levelName}.97* If the {@code levelName} is {@code null}, the level98* of the specified logger is set to {@code null} and99* the effective level of the logger is inherited from100* its nearest ancestor with a specific (non-null) level value.101*102* @param loggerName The name of the {@code Logger} to be set.103* Must be non-null.104* @param levelName The name of the level to set on the specified logger,105* or {@code null} if setting the level to inherit106* from its nearest ancestor.107*108* @throws IllegalArgumentException if the specified logger109* does not exist, or {@code levelName} is not a valid level name.110*111* @throws SecurityException if a security manager exists and if112* the caller does not have LoggingPermission("control").113*114* @see Logger#setLevel115*/116public void setLoggerLevel(String loggerName, String levelName);117118/**119* Returns the name of the parent for the specified logger.120* If the specified logger does not exist, {@code null} is returned.121* If the specified logger is the root {@code Logger} in the namespace,122* the result will be an empty string.123*124* @param loggerName The name of a {@code Logger}.125*126* @return the name of the nearest existing parent logger;127* an empty string if the specified logger is the root logger.128* If the specified logger does not exist, {@code null}129* is returned.130*/131public String getParentLoggerName(String loggerName);132}133134135