Ehcache 1.5.0 User Guide - Logging 日志(10)

 

10Logging 日志

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应该提供任何问题的更多的源信息。许多日志系统可以在不重启应用程序修改日志级别。)

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值