Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
9dfecbbc
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
9dfecbbc
编写于
9月 22, 2010
作者:
O
ohair
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
d85d66d8
8ff5fd3f
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
38 addition
and
2 deletion
+38
-2
src/share/classes/java/util/logging/LogManager.java
src/share/classes/java/util/logging/LogManager.java
+13
-0
src/share/classes/java/util/logging/Logger.java
src/share/classes/java/util/logging/Logger.java
+25
-2
未找到文件。
src/share/classes/java/util/logging/LogManager.java
浏览文件 @
9dfecbbc
...
...
@@ -690,6 +690,11 @@ public class LogManager {
* Note that since untrusted code may create loggers with
* arbitrary names this method should not be relied on to
* find Loggers for security sensitive logging.
* It is also important to note that the Logger associated with the
* String {@code name} may be garbage collected at any time if there
* is no strong reference to the Logger. The caller of this method
* must check the return value for null in order to properly handle
* the case where the Logger has been garbage collected.
* <p>
* @param name name of the logger
* @return matching logger or null if none is found
...
...
@@ -713,6 +718,14 @@ public class LogManager {
* <p>
* Note: Loggers may be added dynamically as new classes are loaded.
* This method only reports on the loggers that are currently registered.
* It is also important to note that this method only returns the name
* of a Logger, not a strong reference to the Logger itself.
* The returned String does nothing to prevent the Logger from being
* garbage collected. In particular, if the returned name is passed
* to {@code LogManager.getLogger()}, then the caller must check the
* return value from {@code LogManager.getLogger()} for null to properly
* handle the case where the Logger has been garbage collected in the
* time since its name was returned by this method.
* <p>
* @return enumeration of logger name strings
*/
...
...
src/share/classes/java/util/logging/Logger.java
浏览文件 @
9dfecbbc
...
...
@@ -42,7 +42,10 @@ import java.lang.ref.WeakReference;
* <p>
* Logger objects may be obtained by calls on one of the getLogger
* factory methods. These will either create a new Logger or
* return a suitable existing Logger.
* return a suitable existing Logger. It is important to note that
* the Logger returned by one of the {@code getLogger} factory methods
* may be garbage collected at any time if a strong reference to the
* Logger is not kept.
* <p>
* Logging messages will be forwarded to registered Handler
* objects, which can forward the messages to a variety of
...
...
@@ -210,7 +213,9 @@ public class Logger {
* who are making serious use of the logging package (for example
* in products) should create and use their own Logger objects,
* with appropriate names, so that logging can be controlled on a
* suitable per-Logger granularity.
* suitable per-Logger granularity. Developers also need to keep a
* strong reference to their Logger objects to prevent them from
* being garbage collected.
* <p>
* @deprecated Initialization of this field is prone to deadlocks.
* The field must be initialized by the Logger class initialization
...
...
@@ -287,6 +292,15 @@ public class Logger {
* based on the LogManager configuration and it will configured
* to also send logging output to its parent's Handlers. It will
* be registered in the LogManager global namespace.
* <p>
* Note: The LogManager may only retain a weak reference to the newly
* created Logger. It is important to understand that a previously
* created Logger with the given name may be garbage collected at any
* time if there is no strong reference to the Logger. In particular,
* this means that two back-to-back calls like
* {@code getLogger("MyLogger").log(...)} may use different Logger
* objects named "MyLogger" if there is no strong reference to the
* Logger named "MyLogger" elsewhere in the program.
*
* @param name A name for the logger. This should
* be a dot-separated name and should normally
...
...
@@ -311,6 +325,15 @@ public class Logger {
* output to its parent's Handlers. It will be registered in
* the LogManager global namespace.
* <p>
* Note: The LogManager may only retain a weak reference to the newly
* created Logger. It is important to understand that a previously
* created Logger with the given name may be garbage collected at any
* time if there is no strong reference to the Logger. In particular,
* this means that two back-to-back calls like
* {@code getLogger("MyLogger", ...).log(...)} may use different Logger
* objects named "MyLogger" if there is no strong reference to the
* Logger named "MyLogger" elsewhere in the program.
* <p>
* If the named Logger already exists and does not yet have a
* localization resource bundle then the given resource bundle
* name is used. If the named Logger already exists and has
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录