Path: blob/master/jcl/src/java.logging/share/classes/java/util/logging/LoggingMXBean.java
12576 views
/*[INCLUDE-IF Sidecar17 & !Sidecar19-SE]*/1/*******************************************************************************2* Copyright (c) 2005, 2017 IBM Corp. and others3*4* This program and the accompanying materials are made available under5* the terms of the Eclipse Public License 2.0 which accompanies this6* distribution and is available at https://www.eclipse.org/legal/epl-2.0/7* or the Apache License, Version 2.0 which accompanies this distribution and8* is available at https://www.apache.org/licenses/LICENSE-2.0.9*10* This Source Code may also be made available under the following11* Secondary Licenses when the conditions for such availability set12* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU13* General Public License, version 2 with the GNU Classpath14* Exception [1] and GNU General Public License, version 2 with the15* OpenJDK Assembly Exception [2].16*17* [1] https://www.gnu.org/software/classpath/license.html18* [2] http://openjdk.java.net/legal/assembly-exception.html19*20* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception21*******************************************************************************/22package java.util.logging;2324import java.util.List;2526/**27* The management and monitoring interface for the logging system of the28* virtual machine.29* <p>30* Precisely one instance of this interface will be made available to management31* clients.32* </p>33* <p>34* Accessing this <code>MXBean</code> can be done in one of three ways. <br/>35* <ol>36* <li>Invoking the static {@link LogManager#getLoggingMXBean()}method.37* </li>38* <li>Using a javax.management.MBeanServerConnection.</li>39* <li>Obtaining a proxy MXBean from the static40* {@link ManagementFactory#newPlatformMXBeanProxy}method, passing in41* "java.util.logging:type=Logging" for the value of the second parameter.42* </li>43* </ol>44* </p>45*46* @since 1.547*/48public interface LoggingMXBean {4950/**51* Returns the string name of the specified {@link Logger}instance's52* current log level.53*54* @param loggerName55* the name of a particular <code>Logger</code> instance56* @return if <code>loggerName</code> resolves to an existing registered57* <code>Logger</code> instance, the log level of that instance.58* Note that if it is the case that the <code>Logger</code> just59* inherits its log level rather than specifying its own, then an60* empty string (<code>""</code>) will be returned. If61* <code>loggerName</code> does not resolve to a registered62* instance of <code>Logger</code> then a <code>null</code>63* value is returned.64*/65public String getLoggerLevel(String loggerName);6667/**68* Returns a list of the names of all of the currently registered69* <code>Logger</code> instances.70* @return a list of the names of all registered <code>Logger</code> objects.71*/72public List<String> getLoggerNames();7374/**75* Returns the name of the parent {@link Logger}of the specified registered76* <code>Logger</code>,<code>loggerName</code>.77*78* @param loggerName79* the name of a particular <code>Logger</code> instance80* @return if <code>loggerName</code> resolves to an existing registered81* <code>Logger</code> instance, the name of its parent82* <code>Logger</code>. If the <code>Logger</code> is the root83* entry in the <code>Logger</code> hierarchy, then an empty84* string (<code>""</code>) will be returned. If85* <code>loggerName</code> does not resolve to a registered86* instance of <code>Logger</code> then a <code>null</code>87* value is returned.88*/89public String getParentLoggerName(String loggerName);9091/**92* Attempts to update the log level of the {@link Logger} with name93* <code>loggerName</code> to <code>levelName</code>.94* <p>95* If <code>levelName</code> is <code>null</code> then the <code>Logger</code>96* instance's log level is set to be <code>null</code> with the result that97* it will inherit its log level from its nearest parent which does not have98* a <code>null</code> log level value.99* </p>100* @param loggerName the name of a registered <code>Logger</code>101* @param levelName the name of the new log level. May be <code>null</code>,102* in which case <code>loggerName</code> will inherit the log level of its103* closest parent with a non-<code>null</code> log level.104* @throws IllegalArgumentException if there is no <code>Logger</code>105* with the name <code>loggerName</code>. Also may be thrown if106* <code>loggerName</code> is not a known log level name.107* @throws SecurityException if there is a security manager active and108* the caller does not have {@link LoggingPermission} of "control".109*/110public void setLoggerLevel(String loggerName, String levelName);111}112113114