gpt4 book ai didi

FileHandler.level 不覆盖全局级别

转载 作者:行者123 更新时间:2023-12-01 05:00:44 26 4
gpt4 key购买 nike

我正在使用jdk日志记录,并且我在logging.properties中有以下内容:

handlers= java.util.logging.FileHandler
.level= INFO

java.util.logging.FileHandler.level = FINEST
java.util.logging.FileHandler.pattern = log/soap_%g.log
java.util.logging.FileHandler.limit = 50000
java.util.logging.FileHandler.count = 1
java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter

# Limit the message that are printed on the console to INFO and above.
java.util.logging.ConsoleHandler.level = FINEST
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter


############################################################
# Facility specific properties.
# Provides extra control for each logger.
############################################################

# For example, set the com.xyz.foo logger to only log SEVERE
# messages:
com.pvm.ccd.service.client=FINEST
com.pvm.ccd.service.client.handler=FINEST
com.pvm.ccd.service.client.util=FINEST

正在创建日志文件soap_0.log 和lck 文件,但是,我在日志文件中没有看到任何log.fine(msg) 条目。由于我已将 FileHandler 级别设置为 FINEST,它应该覆盖全局 INFO 级别,不是吗?

我是java 1.6 u15。我究竟做错了什么?

我已经发布了问题here也是如此。

最佳答案

来自LogManager文档:

All properties whose names end with ".level" are assumed to define log levels for Loggers. Thus "foo.level" defines a log level for the logger called "foo" and (recursively) for any of its children in the naming hierarchy.

下列行不正确:

com.pvm.ccd.service.client=FINEST
com.pvm.ccd.service.client.handler=最好的
com.pvm.ccd.service.client.util=FINEST

要设置记录器的级别,需要:

com.pvm.ccd.service.client.level=FINEST

关于FileHandler.level 不覆盖全局级别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13422805/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com