Log4J的阈值意味着什么? [英] What does threshold mean in Log4J?

查看:103
本文介绍了Log4J的阈值意味着什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好
我有一个类似下面的log4j属性。 TextProcessor.log中记录的所有内容都高于WARN级别。我不明白这里设置的调试阈值。有人可以解释阈值的作用

Hi All I have a log4j properties something like the below. Everything that is logged in TextProcessor.log is something is above above WARN level. I don't understand the threshold that is set here to debug. Can someone explain what the threshold does

log4j.logger.TextProcessor=warn,TextProcessor


log4j.appender.TextProcessor=org.apache.log4j.RollingFileAppender
log4j.appender.TextProcessor.File=C:/project/logs/TextProcessor.log
log4j.appender.TextProcessor.MaxFileSize=10MB
log4j.appender.TextProcessor.MaxBackupIndex=10
log4j.appender.TextProcessor.Threshold=debug
log4j.appender.TextProcessor.layout=org.apache.log4j.PatternLayout
log4j.appender.TextProcessor.layout.ConversionPattern=[%d] [%5p] (%F:%L) - %m%n

提前致谢

推荐答案

这里有两件事:记录器和追加器。不幸的是,你为两者选择了相同的名称,这并不是很清楚。

You have two things here : a logger, and an appender. Unfortunately, you chose the same name for both, which doesn't make it very clear.

记录器的最低级别设置为警告,这意味着您使用此记录器记录的所有内容(至少没有警告级别)将被忽略。

The logger's minimum level is set to warn, which means everything you log with this logger which doesn't have at least the warn level will be ignored.

一旦记录器接受了一条消息,它就会被发送到一个或多个appender(一个文件,一个控制台,一个邮件服务器等)。这些appender中的每一个都可以定义阈值。例如,您可以将控制台中的消息限制为错误,但接受日志文件中的警告消息。

Once a message is accepted by the logger, it's sent to one or several appenders (to a file, to the console, to a mail server, etc.). Each of these appenders may define a threshold. You could for example limit the messages in the console to errors, but accept warn messages in the log file.

这篇关于Log4J的阈值意味着什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆