1806N/A/*
2362N/A * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
1806N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1806N/A *
1806N/A * This code is free software; you can redistribute it and/or modify it
1806N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
1806N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
1806N/A *
1806N/A * This code is distributed in the hope that it will be useful, but WITHOUT
1806N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1806N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1806N/A * version 2 for more details (a copy is included in the LICENSE file that
1806N/A * accompanied this code).
1806N/A *
1806N/A * You should have received a copy of the GNU General Public License version
1806N/A * 2 along with this work; if not, write to the Free Software Foundation,
1806N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1806N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
1806N/A */
1806N/A
3887N/Apackage java.lang.management;
1806N/A
1806N/A/**
3887N/A * The management interface for the {@linkplain java.util.logging logging} facility.
1806N/A *
3887N/A * <p>There is a single global instance of the <tt>PlatformLoggingMXBean</tt>.
3887N/A * The {@link java.lang.management.ManagementFactory#getPlatformMXBean(Class)
3887N/A * ManagementFactory.getPlatformMXBean} method can be used to obtain
1806N/A * the {@code PlatformLoggingMXBean} object as follows:
1806N/A * <pre>
3887N/A * PlatformLoggingMXBean logging = ManagementFactory.getPlatformMXBean(PlatformLoggingMXBean.class);
1806N/A * </pre>
3887N/A * The {@code PlatformLoggingMXBean} object is also registered with the
3887N/A * platform {@linkplain java.lang.management.ManagementFactory#getPlatformMBeanServer
3887N/A * MBeanServer}.
1806N/A * The {@link javax.management.ObjectName ObjectName} for uniquely
3887N/A * identifying the {@code PlatformLoggingMXBean} within an MBeanServer is:
3887N/A * <pre>
3887N/A * {@link java.util.logging.LogManager#LOGGING_MXBEAN_NAME java.util.logging:type=Logging}
3887N/A * </pre>
1806N/A *
3887N/A * <p>The instance registered in the platform <tt>MBeanServer</tt> with
3887N/A * this {@code ObjectName} implements all attributes defined by
3887N/A * {@link java.util.logging.LoggingMXBean}.
1806N/A *
1806N/A * @since 1.7
1806N/A */
3887N/Apublic interface PlatformLoggingMXBean extends PlatformManagedObject {
3887N/A
3887N/A /**
3887N/A * Returns the list of the currently registered
3887N/A * {@linkplain java.util.logging.Logger logger} names. This method
3887N/A * calls {@link java.util.logging.LogManager#getLoggerNames} and
3887N/A * returns a list of the logger names.
3887N/A *
3887N/A * @return A list of {@code String} each of which is a
3887N/A * currently registered {@code Logger} name.
3887N/A */
3887N/A java.util.List<String> getLoggerNames();
3887N/A
3887N/A /**
3887N/A * Gets the name of the log {@linkplain java.util.logging.Logger#getLevel
3887N/A * level} associated with the specified logger.
3887N/A * If the specified logger does not exist, {@code null}
3887N/A * is returned.
3887N/A * This method first finds the logger of the given name and
3887N/A * then returns the name of the log level by calling:
3887N/A * <blockquote>
3887N/A * {@link java.util.logging.Logger#getLevel
3887N/A * Logger.getLevel()}.{@link java.util.logging.Level#getName getName()};
3887N/A * </blockquote>
3887N/A *
3887N/A * <p>
3887N/A * If the {@code Level} of the specified logger is {@code null},
3887N/A * which means that this logger's effective level is inherited
3887N/A * from its parent, an empty string will be returned.
3887N/A *
3887N/A * @param loggerName The name of the {@code Logger} to be retrieved.
3887N/A *
3887N/A * @return The name of the log level of the specified logger; or
3887N/A * an empty string if the log level of the specified logger
3887N/A * is {@code null}. If the specified logger does not
3887N/A * exist, {@code null} is returned.
3887N/A *
3887N/A * @see java.util.logging.Logger#getLevel
3887N/A */
3887N/A String getLoggerLevel(String loggerName);
3887N/A
3887N/A /**
3887N/A * Sets the specified logger to the specified new
3887N/A * {@linkplain java.util.logging.Logger#setLevel level}.
3887N/A * If the {@code levelName} is not {@code null}, the level
3887N/A * of the specified logger is set to the parsed
3887N/A * {@link java.util.logging.Level Level}
3887N/A * matching the {@code levelName}.
3887N/A * If the {@code levelName} is {@code null}, the level
3887N/A * of the specified logger is set to {@code null} and
3887N/A * the effective level of the logger is inherited from
3887N/A * its nearest ancestor with a specific (non-null) level value.
3887N/A *
3887N/A * @param loggerName The name of the {@code Logger} to be set.
3887N/A * Must be non-null.
3887N/A * @param levelName The name of the level to set on the specified logger,
3887N/A * or {@code null} if setting the level to inherit
3887N/A * from its nearest ancestor.
3887N/A *
3887N/A * @throws IllegalArgumentException if the specified logger
3887N/A * does not exist, or {@code levelName} is not a valid level name.
3887N/A *
3887N/A * @throws SecurityException if a security manager exists and if
3887N/A * the caller does not have LoggingPermission("control").
3887N/A *
3887N/A * @see java.util.logging.Logger#setLevel
3887N/A */
3887N/A void setLoggerLevel(String loggerName, String levelName);
3887N/A
3887N/A /**
3887N/A * Returns the name of the
3887N/A * {@linkplain java.util.logging.Logger#getParent parent}
3887N/A * for the specified logger.
3887N/A * If the specified logger does not exist, {@code null} is returned.
3887N/A * If the specified logger is the root {@code Logger} in the namespace,
3887N/A * the result will be an empty string.
3887N/A *
3887N/A * @param loggerName The name of a {@code Logger}.
3887N/A *
3887N/A * @return the name of the nearest existing parent logger;
3887N/A * an empty string if the specified logger is the root logger.
3887N/A * If the specified logger does not exist, {@code null}
3887N/A * is returned.
3887N/A */
3887N/A String getParentLoggerName(String loggerName);
1806N/A}