src/java.logging/share/classes/java/util/logging/LoggingMXBean.java
author shade
Wed, 02 May 2018 19:26:44 +0200
changeset 49951 65b13c206495
parent 47216 71c04702a3d5
permissions -rw-r--r--
8202418: Remove explicit CMS checks in CardTableBarrierSetAssembler: ARM32 leftovers Reviewed-by: eosterlund
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
14342
8435a30053c1 7197491: update copyright year to match last edit in jdk8 jdk repository
alanb
parents: 9013
diff changeset
     2
 * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4172
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4172
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4172
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4172
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4172
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package java.util.logging;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
401
ef01e0dccd63 6610094: Add generic support for platform MXBeans of any type (also fixed 6681031)
mchung
parents: 2
diff changeset
    28
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
/**
38370
61f46e1e7aee 8139982: Re-examine java.management dependency on java.util.logging.LoggingMXBean
dfuchs
parents: 32037
diff changeset
    30
 * The management interface for the logging facility.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 *
38370
61f46e1e7aee 8139982: Re-examine java.management dependency on java.util.logging.LoggingMXBean
dfuchs
parents: 32037
diff changeset
    32
 * {@link java.lang.management.PlatformLoggingMXBean
61f46e1e7aee 8139982: Re-examine java.management dependency on java.util.logging.LoggingMXBean
dfuchs
parents: 32037
diff changeset
    33
 * java.lang.management.PlatformLoggingMXBean} is the management interface
61f46e1e7aee 8139982: Re-examine java.management dependency on java.util.logging.LoggingMXBean
dfuchs
parents: 32037
diff changeset
    34
 * for logging facility registered in the {@link
61f46e1e7aee 8139982: Re-examine java.management dependency on java.util.logging.LoggingMXBean
dfuchs
parents: 32037
diff changeset
    35
 * java.lang.management.ManagementFactory#getPlatformMBeanServer()
32037
ab4526f4ac10 8133115: docs: replace <tt> tags (obsolete in html5) for java.util.logging, java.util.prefs, java.util.zip, java.util.jar
avstepan
parents: 25859
diff changeset
    36
 * platform MBeanServer}.
38370
61f46e1e7aee 8139982: Re-examine java.management dependency on java.util.logging.LoggingMXBean
dfuchs
parents: 32037
diff changeset
    37
 * It is recommended to use the {@code PlatformLoggingMXBean} obtained via
61f46e1e7aee 8139982: Re-examine java.management dependency on java.util.logging.LoggingMXBean
dfuchs
parents: 32037
diff changeset
    38
 * the {@link java.lang.management.ManagementFactory#getPlatformMXBean(Class)
61f46e1e7aee 8139982: Re-examine java.management dependency on java.util.logging.LoggingMXBean
dfuchs
parents: 32037
diff changeset
    39
 * ManagementFactory.getPlatformMXBean(PlatformLoggingMXBean.class)} method.
61f46e1e7aee 8139982: Re-examine java.management dependency on java.util.logging.LoggingMXBean
dfuchs
parents: 32037
diff changeset
    40
 *
61f46e1e7aee 8139982: Re-examine java.management dependency on java.util.logging.LoggingMXBean
dfuchs
parents: 32037
diff changeset
    41
 * @deprecated {@code LoggingMXBean} is no longer a {@link
61f46e1e7aee 8139982: Re-examine java.management dependency on java.util.logging.LoggingMXBean
dfuchs
parents: 32037
diff changeset
    42
 * java.lang.management.PlatformManagedObject platform MXBean} and is replaced
61f46e1e7aee 8139982: Re-examine java.management dependency on java.util.logging.LoggingMXBean
dfuchs
parents: 32037
diff changeset
    43
 * with {@link java.lang.management.PlatformLoggingMXBean}.
61f46e1e7aee 8139982: Re-examine java.management dependency on java.util.logging.LoggingMXBean
dfuchs
parents: 32037
diff changeset
    44
 * It will not register in the platform {@code MBeanServer}.
61f46e1e7aee 8139982: Re-examine java.management dependency on java.util.logging.LoggingMXBean
dfuchs
parents: 32037
diff changeset
    45
 * Use {@code ManagementFactory.getPlatformMXBean(PlatformLoggingMXBean.class)}
61f46e1e7aee 8139982: Re-examine java.management dependency on java.util.logging.LoggingMXBean
dfuchs
parents: 32037
diff changeset
    46
 * instead.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * @author  Ron Mann
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * @author  Mandy Chung
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * @since   1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 *
9013
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
    52
 * @see java.lang.management.PlatformLoggingMXBean
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 */
38370
61f46e1e7aee 8139982: Re-examine java.management dependency on java.util.logging.LoggingMXBean
dfuchs
parents: 32037
diff changeset
    54
@Deprecated(since="9")
4172
bceea7bc12b7 6876135: Add PlatformLoggingMXBean to eliminate the dependency on JMX from logging
mchung
parents: 3853
diff changeset
    55
public interface LoggingMXBean {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
    /**
9013
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
    58
     * Returns the list of currently registered logger names. This method
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
     * calls {@link LogManager#getLoggerNames} and returns a list
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
     * of the logger names.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
     *
32037
ab4526f4ac10 8133115: docs: replace <tt> tags (obsolete in html5) for java.util.logging, java.util.prefs, java.util.zip, java.util.jar
avstepan
parents: 25859
diff changeset
    62
     * @return A list of {@code String} each of which is a
ab4526f4ac10 8133115: docs: replace <tt> tags (obsolete in html5) for java.util.logging, java.util.prefs, java.util.zip, java.util.jar
avstepan
parents: 25859
diff changeset
    63
     *         currently registered {@code Logger} name.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
    public java.util.List<String> getLoggerNames();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
     * Gets the name of the log level associated with the specified logger.
32037
ab4526f4ac10 8133115: docs: replace <tt> tags (obsolete in html5) for java.util.logging, java.util.prefs, java.util.zip, java.util.jar
avstepan
parents: 25859
diff changeset
    69
     * If the specified logger does not exist, {@code null}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
     * is returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
     * This method first finds the logger of the given name and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
     * then returns the name of the log level by calling:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
     * <blockquote>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
     *   {@link Logger#getLevel Logger.getLevel()}.{@link Level#getName getName()};
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
     * </blockquote>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
     * <p>
32037
ab4526f4ac10 8133115: docs: replace <tt> tags (obsolete in html5) for java.util.logging, java.util.prefs, java.util.zip, java.util.jar
avstepan
parents: 25859
diff changeset
    78
     * If the {@code Level} of the specified logger is {@code null},
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
     * which means that this logger's effective level is inherited
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
     * from its parent, an empty string will be returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
     *
32037
ab4526f4ac10 8133115: docs: replace <tt> tags (obsolete in html5) for java.util.logging, java.util.prefs, java.util.zip, java.util.jar
avstepan
parents: 25859
diff changeset
    82
     * @param loggerName The name of the {@code Logger} to be retrieved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
     * @return The name of the log level of the specified logger; or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
     *         an empty string if the log level of the specified logger
32037
ab4526f4ac10 8133115: docs: replace <tt> tags (obsolete in html5) for java.util.logging, java.util.prefs, java.util.zip, java.util.jar
avstepan
parents: 25859
diff changeset
    86
     *         is {@code null}.  If the specified logger does not
ab4526f4ac10 8133115: docs: replace <tt> tags (obsolete in html5) for java.util.logging, java.util.prefs, java.util.zip, java.util.jar
avstepan
parents: 25859
diff changeset
    87
     *         exist, {@code null} is returned.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
     * @see Logger#getLevel
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     */
9013
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
    91
    public String getLoggerLevel(String loggerName);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
     * Sets the specified logger to the specified new level.
32037
ab4526f4ac10 8133115: docs: replace <tt> tags (obsolete in html5) for java.util.logging, java.util.prefs, java.util.zip, java.util.jar
avstepan
parents: 25859
diff changeset
    95
     * If the {@code levelName} is not {@code null}, the level
ab4526f4ac10 8133115: docs: replace <tt> tags (obsolete in html5) for java.util.logging, java.util.prefs, java.util.zip, java.util.jar
avstepan
parents: 25859
diff changeset
    96
     * of the specified logger is set to the parsed {@code Level}
ab4526f4ac10 8133115: docs: replace <tt> tags (obsolete in html5) for java.util.logging, java.util.prefs, java.util.zip, java.util.jar
avstepan
parents: 25859
diff changeset
    97
     * matching the {@code levelName}.
ab4526f4ac10 8133115: docs: replace <tt> tags (obsolete in html5) for java.util.logging, java.util.prefs, java.util.zip, java.util.jar
avstepan
parents: 25859
diff changeset
    98
     * If the {@code levelName} is {@code null}, the level
ab4526f4ac10 8133115: docs: replace <tt> tags (obsolete in html5) for java.util.logging, java.util.prefs, java.util.zip, java.util.jar
avstepan
parents: 25859
diff changeset
    99
     * of the specified logger is set to {@code null} and
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
     * the effective level of the logger is inherited from
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
     * its nearest ancestor with a specific (non-null) level value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     *
32037
ab4526f4ac10 8133115: docs: replace <tt> tags (obsolete in html5) for java.util.logging, java.util.prefs, java.util.zip, java.util.jar
avstepan
parents: 25859
diff changeset
   103
     * @param loggerName The name of the {@code Logger} to be set.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
     *                   Must be non-null.
3853
9d2382b74894 6882363: 4/4 typos in java.util.logging javadocs
dcubed
parents: 715
diff changeset
   105
     * @param levelName The name of the level to set on the specified logger,
32037
ab4526f4ac10 8133115: docs: replace <tt> tags (obsolete in html5) for java.util.logging, java.util.prefs, java.util.zip, java.util.jar
avstepan
parents: 25859
diff changeset
   106
     *                 or {@code null} if setting the level to inherit
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
     *                 from its nearest ancestor.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
     * @throws IllegalArgumentException if the specified logger
32037
ab4526f4ac10 8133115: docs: replace <tt> tags (obsolete in html5) for java.util.logging, java.util.prefs, java.util.zip, java.util.jar
avstepan
parents: 25859
diff changeset
   110
     * does not exist, or {@code levelName} is not a valid level name.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
     * @throws SecurityException if a security manager exists and if
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
     * the caller does not have LoggingPermission("control").
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
     * @see Logger#setLevel
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
     */
9013
eedac0b9f552 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents: 5506
diff changeset
   117
    public void setLoggerLevel(String loggerName, String levelName);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
     * Returns the name of the parent for the specified logger.
32037
ab4526f4ac10 8133115: docs: replace <tt> tags (obsolete in html5) for java.util.logging, java.util.prefs, java.util.zip, java.util.jar
avstepan
parents: 25859
diff changeset
   121
     * If the specified logger does not exist, {@code null} is returned.
ab4526f4ac10 8133115: docs: replace <tt> tags (obsolete in html5) for java.util.logging, java.util.prefs, java.util.zip, java.util.jar
avstepan
parents: 25859
diff changeset
   122
     * If the specified logger is the root {@code Logger} in the namespace,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
     * the result will be an empty string.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
     *
32037
ab4526f4ac10 8133115: docs: replace <tt> tags (obsolete in html5) for java.util.logging, java.util.prefs, java.util.zip, java.util.jar
avstepan
parents: 25859
diff changeset
   125
     * @param loggerName The name of a {@code Logger}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
     * @return the name of the nearest existing parent logger;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
     *         an empty string if the specified logger is the root logger.
32037
ab4526f4ac10 8133115: docs: replace <tt> tags (obsolete in html5) for java.util.logging, java.util.prefs, java.util.zip, java.util.jar
avstepan
parents: 25859
diff changeset
   129
     *         If the specified logger does not exist, {@code null}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
     *         is returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
    public String getParentLoggerName(String loggerName);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
}