1 /* 2 * Copyright (C) 2014 The Android Open Source Project 3 * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. 4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5 * 6 * This code is free software; you can redistribute it and/or modify it 7 * under the terms of the GNU General Public License version 2 only, as 8 * published by the Free Software Foundation. Oracle designates this 9 * particular file as subject to the "Classpath" exception as provided 10 * by Oracle in the LICENSE file that accompanied this code. 11 * 12 * This code is distributed in the hope that it will be useful, but WITHOUT 13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15 * version 2 for more details (a copy is included in the LICENSE file that 16 * accompanied this code). 17 * 18 * You should have received a copy of the GNU General Public License version 19 * 2 along with this work; if not, write to the Free Software Foundation, 20 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 21 * 22 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 23 * or visit www.oracle.com if you need additional information or have any 24 * questions. 25 */ 26 27 package java.util.logging; 28 29 // Android-removed: References to java.lang.management in javadoc. 30 31 /** 32 * The management interface for the logging facility. 33 * 34 * <p>There is a single global instance of the <tt>LoggingMXBean</tt>. 35 * 36 * The {@code javax.management.ObjectName ObjectName} that uniquely identifies 37 * the management interface for logging within the {@code MBeanServer} is: 38 * <pre> 39 * {@link LogManager#LOGGING_MXBEAN_NAME java.util.logging:type=Logging} 40 * </pre> 41 * <p> 42 * 43 * @author Ron Mann 44 * @author Mandy Chung 45 * @since 1.5 46 * 47 */ 48 public interface LoggingMXBean { 49 50 /** 51 * Returns the list of currently registered logger names. This method 52 * calls {@link LogManager#getLoggerNames} and returns a list 53 * of the logger names. 54 * 55 * @return A list of <tt>String</tt> each of which is a 56 * currently registered <tt>Logger</tt> name. 57 */ getLoggerNames()58 public java.util.List<String> getLoggerNames(); 59 60 /** 61 * Gets the name of the log level associated with the specified logger. 62 * If the specified logger does not exist, <tt>null</tt> 63 * is returned. 64 * This method first finds the logger of the given name and 65 * then returns the name of the log level by calling: 66 * <blockquote> 67 * {@link Logger#getLevel Logger.getLevel()}.{@link Level#getName getName()}; 68 * </blockquote> 69 * 70 * <p> 71 * If the <tt>Level</tt> of the specified logger is <tt>null</tt>, 72 * which means that this logger's effective level is inherited 73 * from its parent, an empty string will be returned. 74 * 75 * @param loggerName The name of the <tt>Logger</tt> to be retrieved. 76 * 77 * @return The name of the log level of the specified logger; or 78 * an empty string if the log level of the specified logger 79 * is <tt>null</tt>. If the specified logger does not 80 * exist, <tt>null</tt> is returned. 81 * 82 * @see Logger#getLevel 83 */ getLoggerLevel(String loggerName)84 public String getLoggerLevel(String loggerName); 85 86 /** 87 * Sets the specified logger to the specified new level. 88 * If the <tt>levelName</tt> is not <tt>null</tt>, the level 89 * of the specified logger is set to the parsed <tt>Level</tt> 90 * matching the <tt>levelName</tt>. 91 * If the <tt>levelName</tt> is <tt>null</tt>, the level 92 * of the specified logger is set to <tt>null</tt> and 93 * the effective level of the logger is inherited from 94 * its nearest ancestor with a specific (non-null) level value. 95 * 96 * @param loggerName The name of the <tt>Logger</tt> to be set. 97 * Must be non-null. 98 * @param levelName The name of the level to set on the specified logger, 99 * or <tt>null</tt> if setting the level to inherit 100 * from its nearest ancestor. 101 * 102 * @throws IllegalArgumentException if the specified logger 103 * does not exist, or <tt>levelName</tt> is not a valid level name. 104 * 105 * @throws SecurityException if a security manager exists and if 106 * the caller does not have LoggingPermission("control"). 107 * 108 * @see Logger#setLevel 109 */ setLoggerLevel(String loggerName, String levelName)110 public void setLoggerLevel(String loggerName, String levelName); 111 112 /** 113 * Returns the name of the parent for the specified logger. 114 * If the specified logger does not exist, <tt>null</tt> is returned. 115 * If the specified logger is the root <tt>Logger</tt> in the namespace, 116 * the result will be an empty string. 117 * 118 * @param loggerName The name of a <tt>Logger</tt>. 119 * 120 * @return the name of the nearest existing parent logger; 121 * an empty string if the specified logger is the root logger. 122 * If the specified logger does not exist, <tt>null</tt> 123 * is returned. 124 */ getParentLoggerName(String loggerName)125 public String getParentLoggerName(String loggerName); 126 } 127