您的位置:首页 > 产品设计 > UI/UE

Ehcache 1.5.0 User Guide - Logging 日志(10)

2009-08-14 10:45 344 查看

10、Logging 日志

10.1 Java Util Logging

As of 1.6, Ehcache uses the built-in Java Util library ("j.u.l") for logging.
1.6版本以前使用java util库内置的记录日志。

10.2 Working with SL4J (使用SL4J工作)

Simple Logging Facade For Java (SL4J) is an increasingly popular replacement for commons-logging.
(java的简单的日志门面是一个日益流行替代commons-logging的替代品。)
You can still log via SL4J using the SLF4JBridgeHandler. See http://www.slf4j.org/legacy.html According to http://blog.cn-consult.dk/2009/03/bridging-javautillogging-to-slf4j.html this will install an extra logger. To stop j.u.l. from logging at all .
To remove j.u.l logging all together use the following code snippet.
(你可以使用SLF4JBridgeHandler 对象通过SL4J记录日志。查看See http://www.slf4j.org/legacy.html
依照http://blog.cn-consult.dk/2009/03/bridging-javautillogging-to-slf4j.html安装一个额外的日志。停止使j.u.l记录日志。
使用下面的代码片段移除j.u.l记录日志。)

java.util.logging.Logger rootLogger = LogManager.getLogManager().getLogger("");
Handler[] handlers = rootLogger.getHandlers();
for (int i = 0; i < handlers.length; i++) {
rootLogger.removeHandler(handlers[i]);
}
SLF4JBridgeHandler.install();

10.3 Recommended Logging Levels(推荐的日志级别)

Ehcache seeks to trade off informing production support developers or important messages and cluttering the log.
SEVERE JDK logging SEVERE messages should not occur in normal production and indicate that action should be taken.
(Ehcahe 努力在支持开发者的产品信息或重要信息和简洁的日志间寻找平衡。
记录严格的信息SEVERE JDK不应该在出现正常生产系统并指示应该采取行动。)

WARN JDK logging WARN messages generally indicate a configuration change should be made or an unusual event has occurred.
(WARN JDK 记录警告信息一般指示需要修改配置或者发生了不寻常的事件。)

FINE JDK logging FINE messages are for development use. All DEBUG level statements are surrounded with a guard so that they are not executed unless the level is DEBUG.
(FINE JDK 记录FINE信息主要为开发使用。所有DEBUG级别的声明是防止的,所有只用级别为DEBUG才能执行。)
Setting the logging level to FINE should provide more information on the source of any problems. Many logging systems enable a logging level change to be made without restarting the application.
(设置日志级别为FINE应该提供任何问题的更多的源信息。许多日志系统可以在不重启应用程序修改日志级别。)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: