author | dfuchs |
Thu, 06 Apr 2017 14:38:15 +0100 | |
changeset 44538 | a603c475d649 |
parent 38370 | 61f46e1e7aee |
permissions | -rw-r--r-- |
2 | 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 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 10 |
* |
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
5506 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
2 | 24 |
*/ |
25 |
||
26 |
package java.util.logging; |
|
27 |
||
401
ef01e0dccd63
6610094: Add generic support for platform MXBeans of any type (also fixed 6681031)
mchung
parents:
2
diff
changeset
|
28 |
|
2 | 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 | 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 | 47 |
* |
48 |
* @author Ron Mann |
|
49 |
* @author Mandy Chung |
|
50 |
* @since 1.5 |
|
51 |
* |
|
9013
eedac0b9f552
7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents:
5506
diff
changeset
|
52 |
* @see java.lang.management.PlatformLoggingMXBean |
2 | 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 | 56 |
|
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 | 59 |
* calls {@link LogManager#getLoggerNames} and returns a list |
60 |
* of the logger names. |
|
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 | 64 |
*/ |
65 |
public java.util.List<String> getLoggerNames(); |
|
66 |
||
67 |
/** |
|
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 | 70 |
* is returned. |
71 |
* This method first finds the logger of the given name and |
|
72 |
* then returns the name of the log level by calling: |
|
73 |
* <blockquote> |
|
74 |
* {@link Logger#getLevel Logger.getLevel()}.{@link Level#getName getName()}; |
|
75 |
* </blockquote> |
|
76 |
* |
|
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 | 79 |
* which means that this logger's effective level is inherited |
80 |
* from its parent, an empty string will be returned. |
|
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 | 83 |
* |
84 |
* @return The name of the log level of the specified logger; or |
|
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 | 88 |
* |
89 |
* @see Logger#getLevel |
|
90 |
*/ |
|
9013
eedac0b9f552
7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents:
5506
diff
changeset
|
91 |
public String getLoggerLevel(String loggerName); |
2 | 92 |
|
93 |
/** |
|
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 | 100 |
* the effective level of the logger is inherited from |
101 |
* its nearest ancestor with a specific (non-null) level value. |
|
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 | 104 |
* Must be non-null. |
3853 | 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 | 107 |
* from its nearest ancestor. |
108 |
* |
|
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 | 111 |
* |
112 |
* @throws SecurityException if a security manager exists and if |
|
113 |
* the caller does not have LoggingPermission("control"). |
|
114 |
* |
|
115 |
* @see Logger#setLevel |
|
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 | 118 |
|
119 |
/** |
|
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 | 123 |
* the result will be an empty string. |
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 | 126 |
* |
127 |
* @return the name of the nearest existing parent logger; |
|
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 | 130 |
* is returned. |
131 |
*/ |
|
132 |
public String getParentLoggerName(String loggerName); |
|
133 |
} |