Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/java.management/share/classes/java/lang/management/PlatformLoggingMXBean.java
41159 views
1
/*
2
* Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
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
7
* published by the Free Software Foundation. Oracle designates this
8
* particular file as subject to the "Classpath" exception as provided
9
* by Oracle in the LICENSE file that accompanied this code.
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
*
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.
24
*/
25
26
package java.lang.management;
27
28
/**
29
* The management interface for the {@linkplain java.util.logging logging} facility.
30
*
31
* <p>There is a single global instance of the {@code PlatformLoggingMXBean}.
32
* The {@link java.lang.management.ManagementFactory#getPlatformMXBean(Class)
33
* ManagementFactory.getPlatformMXBean} method can be used to obtain
34
* the {@code PlatformLoggingMXBean} object as follows:
35
* <pre>
36
* PlatformLoggingMXBean logging = ManagementFactory.getPlatformMXBean(PlatformLoggingMXBean.class);
37
* </pre>
38
* The {@code PlatformLoggingMXBean} object is also registered with the
39
* platform {@linkplain java.lang.management.ManagementFactory#getPlatformMBeanServer
40
* MBeanServer}.
41
* The {@link javax.management.ObjectName ObjectName} for uniquely
42
* identifying the {@code PlatformLoggingMXBean} within an MBeanServer is:
43
* <pre>
44
* {@link java.util.logging.LogManager#LOGGING_MXBEAN_NAME java.util.logging:type=Logging}
45
* </pre>
46
*
47
* @since 1.7
48
*/
49
public interface PlatformLoggingMXBean extends PlatformManagedObject {
50
51
/**
52
* Returns the list of the currently registered
53
* {@linkplain java.util.logging.Logger logger} names. This method
54
* calls {@link java.util.logging.LogManager#getLoggerNames} and
55
* returns a list of the logger names.
56
*
57
* @return A list of {@code String} each of which is a
58
* currently registered {@code Logger} name.
59
*/
60
java.util.List<String> getLoggerNames();
61
62
/**
63
* Gets the name of the log {@linkplain java.util.logging.Logger#getLevel
64
* level} associated with the specified logger.
65
* If the specified logger does not exist, {@code null}
66
* is returned.
67
* This method first finds the logger of the given name and
68
* then returns the name of the log level by calling:
69
* <blockquote>
70
* {@link java.util.logging.Logger#getLevel
71
* Logger.getLevel()}.{@link java.util.logging.Level#getName getName()};
72
* </blockquote>
73
*
74
* <p>
75
* If the {@code Level} of the specified logger is {@code null},
76
* which means that this logger's effective level is inherited
77
* from its parent, an empty string will be returned.
78
*
79
* @param loggerName The name of the {@code Logger} to be retrieved.
80
*
81
* @return The name of the log level of the specified logger; or
82
* an empty string if the log level of the specified logger
83
* is {@code null}. If the specified logger does not
84
* exist, {@code null} is returned.
85
*
86
* @see java.util.logging.Logger#getLevel
87
*/
88
String getLoggerLevel(String loggerName);
89
90
/**
91
* Sets the specified logger to the specified new
92
* {@linkplain java.util.logging.Logger#setLevel level}.
93
* If the {@code levelName} is not {@code null}, the level
94
* of the specified logger is set to the parsed
95
* {@link java.util.logging.Level Level}
96
* matching the {@code levelName}.
97
* If the {@code levelName} is {@code null}, the level
98
* of the specified logger is set to {@code null} and
99
* the effective level of the logger is inherited from
100
* its nearest ancestor with a specific (non-null) level value.
101
*
102
* @param loggerName The name of the {@code Logger} to be set.
103
* Must be non-null.
104
* @param levelName The name of the level to set on the specified logger,
105
* or {@code null} if setting the level to inherit
106
* from its nearest ancestor.
107
*
108
* @throws IllegalArgumentException if the specified logger
109
* does not exist, or {@code levelName} is not a valid level name.
110
*
111
* @throws SecurityException if a security manager exists and if
112
* the caller does not have LoggingPermission("control").
113
*
114
* @see java.util.logging.Logger#setLevel
115
*/
116
void setLoggerLevel(String loggerName, String levelName);
117
118
/**
119
* Returns the name of the
120
* {@linkplain java.util.logging.Logger#getParent parent}
121
* for the specified logger.
122
* If the specified logger does not exist, {@code null} is returned.
123
* If the specified logger is the root {@code Logger} in the namespace,
124
* the result will be an empty string.
125
*
126
* @param loggerName The name of a {@code Logger}.
127
*
128
* @return the name of the nearest existing parent logger;
129
* an empty string if the specified logger is the root logger.
130
* If the specified logger does not exist, {@code null}
131
* is returned.
132
*/
133
String getParentLoggerName(String loggerName);
134
}
135
136