author | alanb |
Fri, 02 Nov 2012 15:50:11 +0000 | |
changeset 14342 | 8435a30053c1 |
parent 9013 | eedac0b9f552 |
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 |
/** |
9013
eedac0b9f552
7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents:
5506
diff
changeset
|
30 |
* The management interface for the logging facility. It is recommended |
eedac0b9f552
7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents:
5506
diff
changeset
|
31 |
* to use the {@link java.lang.management.PlatformLoggingMXBean} management |
eedac0b9f552
7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents:
5506
diff
changeset
|
32 |
* interface that implements all attributes defined in this |
eedac0b9f552
7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents:
5506
diff
changeset
|
33 |
* {@code LoggingMXBean}. The |
eedac0b9f552
7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents:
5506
diff
changeset
|
34 |
* {@link java.lang.management.ManagementFactory#getPlatformMXBean(Class) |
eedac0b9f552
7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents:
5506
diff
changeset
|
35 |
* ManagementFactory.getPlatformMXBean} method can be used to obtain |
eedac0b9f552
7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents:
5506
diff
changeset
|
36 |
* the {@code PlatformLoggingMXBean} object representing the management |
eedac0b9f552
7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents:
5506
diff
changeset
|
37 |
* interface for logging. |
2 | 38 |
* |
39 |
* <p>There is a single global instance of the <tt>LoggingMXBean</tt>. |
|
9013
eedac0b9f552
7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents:
5506
diff
changeset
|
40 |
* This instance is an {@link javax.management.MXBean MXBean} that |
eedac0b9f552
7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents:
5506
diff
changeset
|
41 |
* can be obtained by calling the {@link LogManager#getLoggingMXBean} |
eedac0b9f552
7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents:
5506
diff
changeset
|
42 |
* method or from the |
4172
bceea7bc12b7
6876135: Add PlatformLoggingMXBean to eliminate the dependency on JMX from logging
mchung
parents:
3853
diff
changeset
|
43 |
* {@linkplain java.lang.management.ManagementFactory#getPlatformMBeanServer |
bceea7bc12b7
6876135: Add PlatformLoggingMXBean to eliminate the dependency on JMX from logging
mchung
parents:
3853
diff
changeset
|
44 |
* platform <tt>MBeanServer</tt>}. |
9013
eedac0b9f552
7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents:
5506
diff
changeset
|
45 |
* <p> |
eedac0b9f552
7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents:
5506
diff
changeset
|
46 |
* The {@link javax.management.ObjectName ObjectName} that uniquely identifies |
eedac0b9f552
7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents:
5506
diff
changeset
|
47 |
* the management interface for logging within the {@code MBeanServer} is: |
eedac0b9f552
7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents:
5506
diff
changeset
|
48 |
* <pre> |
eedac0b9f552
7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents:
5506
diff
changeset
|
49 |
* {@link LogManager#LOGGING_MXBEAN_NAME java.util.logging:type=Logging} |
eedac0b9f552
7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents:
5506
diff
changeset
|
50 |
* </pre> |
eedac0b9f552
7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents:
5506
diff
changeset
|
51 |
* <p> |
eedac0b9f552
7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents:
5506
diff
changeset
|
52 |
* The instance registered in the platform {@code MBeanServer} |
eedac0b9f552
7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents:
5506
diff
changeset
|
53 |
* is also a {@link java.lang.management.PlatformLoggingMXBean}. |
2 | 54 |
* |
55 |
* @author Ron Mann |
|
56 |
* @author Mandy Chung |
|
57 |
* @since 1.5 |
|
58 |
* |
|
9013
eedac0b9f552
7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents:
5506
diff
changeset
|
59 |
* @see java.lang.management.PlatformLoggingMXBean |
2 | 60 |
*/ |
4172
bceea7bc12b7
6876135: Add PlatformLoggingMXBean to eliminate the dependency on JMX from logging
mchung
parents:
3853
diff
changeset
|
61 |
public interface LoggingMXBean { |
2 | 62 |
|
63 |
/** |
|
9013
eedac0b9f552
7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents:
5506
diff
changeset
|
64 |
* Returns the list of currently registered logger names. This method |
2 | 65 |
* calls {@link LogManager#getLoggerNames} and returns a list |
66 |
* of the logger names. |
|
67 |
* |
|
68 |
* @return A list of <tt>String</tt> each of which is a |
|
69 |
* currently registered <tt>Logger</tt> name. |
|
70 |
*/ |
|
71 |
public java.util.List<String> getLoggerNames(); |
|
72 |
||
73 |
/** |
|
74 |
* Gets the name of the log level associated with the specified logger. |
|
75 |
* If the specified logger does not exist, <tt>null</tt> |
|
76 |
* is returned. |
|
77 |
* This method first finds the logger of the given name and |
|
78 |
* then returns the name of the log level by calling: |
|
79 |
* <blockquote> |
|
80 |
* {@link Logger#getLevel Logger.getLevel()}.{@link Level#getName getName()}; |
|
81 |
* </blockquote> |
|
82 |
* |
|
83 |
* <p> |
|
84 |
* If the <tt>Level</tt> of the specified logger is <tt>null</tt>, |
|
85 |
* which means that this logger's effective level is inherited |
|
86 |
* from its parent, an empty string will be returned. |
|
87 |
* |
|
88 |
* @param loggerName The name of the <tt>Logger</tt> to be retrieved. |
|
89 |
* |
|
90 |
* @return The name of the log level of the specified logger; or |
|
91 |
* an empty string if the log level of the specified logger |
|
92 |
* is <tt>null</tt>. If the specified logger does not |
|
93 |
* exist, <tt>null</tt> is returned. |
|
94 |
* |
|
95 |
* @see Logger#getLevel |
|
96 |
*/ |
|
9013
eedac0b9f552
7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents:
5506
diff
changeset
|
97 |
public String getLoggerLevel(String loggerName); |
2 | 98 |
|
99 |
/** |
|
100 |
* Sets the specified logger to the specified new level. |
|
101 |
* If the <tt>levelName</tt> is not <tt>null</tt>, the level |
|
102 |
* of the specified logger is set to the parsed <tt>Level</tt> |
|
103 |
* matching the <tt>levelName</tt>. |
|
104 |
* If the <tt>levelName</tt> is <tt>null</tt>, the level |
|
105 |
* of the specified logger is set to <tt>null</tt> and |
|
106 |
* the effective level of the logger is inherited from |
|
107 |
* its nearest ancestor with a specific (non-null) level value. |
|
108 |
* |
|
109 |
* @param loggerName The name of the <tt>Logger</tt> to be set. |
|
110 |
* Must be non-null. |
|
3853 | 111 |
* @param levelName The name of the level to set on the specified logger, |
112 |
* or <tt>null</tt> if setting the level to inherit |
|
2 | 113 |
* from its nearest ancestor. |
114 |
* |
|
115 |
* @throws IllegalArgumentException if the specified logger |
|
116 |
* does not exist, or <tt>levelName</tt> is not a valid level name. |
|
117 |
* |
|
118 |
* @throws SecurityException if a security manager exists and if |
|
119 |
* the caller does not have LoggingPermission("control"). |
|
120 |
* |
|
121 |
* @see Logger#setLevel |
|
122 |
*/ |
|
9013
eedac0b9f552
7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management
mchung
parents:
5506
diff
changeset
|
123 |
public void setLoggerLevel(String loggerName, String levelName); |
2 | 124 |
|
125 |
/** |
|
126 |
* Returns the name of the parent for the specified logger. |
|
127 |
* If the specified logger does not exist, <tt>null</tt> is returned. |
|
128 |
* If the specified logger is the root <tt>Logger</tt> in the namespace, |
|
129 |
* the result will be an empty string. |
|
130 |
* |
|
131 |
* @param loggerName The name of a <tt>Logger</tt>. |
|
132 |
* |
|
133 |
* @return the name of the nearest existing parent logger; |
|
134 |
* an empty string if the specified logger is the root logger. |
|
135 |
* If the specified logger does not exist, <tt>null</tt> |
|
136 |
* is returned. |
|
137 |
*/ |
|
138 |
public String getParentLoggerName(String loggerName); |
|
139 |
} |