log4j 初始化期间的 log4j 日志消息

发布于 2024-09-11 10:03:16 字数 1780 浏览 2 评论 0原文

我试图设置 log4j(基于 xml)配置,使用 LevelRangeFilter,如官方网站。到目前为止一切都很好,除了 log4j 在初始化之前会吐出自己的日志消息。在'完成配置'行之后,一切正常。此外,还有一个错误,指出“log4j:找不到根记录器信息。这样可以吗?”

谢谢。

log4j: reset attribute= "false".
log4j: Threshold ="null".
log4j: Level value for root is  [all].
log4j: root level set to ALL
log4j: Class name: [org.apache.log4j.FileAppender]
log4j: Setting property [file] to [logs/debug.log].
log4j: Parsing layout of class: "org.apache.log4j.PatternLayout"
log4j: Setting property [conversionPattern] to [[%d{ISO8601}] %-5p %c %m %n].
log4j: Setting property [levelMax] to [DEBUG].
log4j: Setting property [levelMin] to [DEBUG].
log4j: Setting property [acceptOnMatch] to [true].
log4j: Adding filter of type [class org.apache.log4j.varia.LevelRangeFilter] to appender named [debug-out].
log4j: setFile called: logs/debug.log, true
log4j: setFile ended
..................
...................
log4j: Adding appender named [error-out] to category [root].
log4j: Class name: [org.apache.log4j.ConsoleAppender]
log4j: Setting property [target] to [System.err].
log4j: Parsing layout of class: "org.apache.log4j.PatternLayout"
log4j: Setting property [conversionPattern] to [[%d{ISO8601}] %-5p %c %m %n].
log4j: Setting property [levelMin] to [INFO].
log4j: Setting property [levelMax] to [FATAL].
log4j: Adding filter of type [class org.apache.log4j.varia.LevelRangeFilter] to appender named [console].
log4j: Adding appender named [console] to category [root].
log4j: Reading configuration from URL file:/C:/Work/test/conf/log4j.xml
log4j: Could not find root logger information. Is this OK?
log4j: Finished configuring.

I was trying to setup log4j (xml based) configuration, Use LevelRangeFilter, as described in the official site. Everything is fine so far, except log4j spit out its own log messages till it initializes. After the 'finished configuration' line, everything is normal. Also, there is an error stating "log4j: Could not find root logger information. Is this OK?" .

thanks.

log4j: reset attribute= "false".
log4j: Threshold ="null".
log4j: Level value for root is  [all].
log4j: root level set to ALL
log4j: Class name: [org.apache.log4j.FileAppender]
log4j: Setting property [file] to [logs/debug.log].
log4j: Parsing layout of class: "org.apache.log4j.PatternLayout"
log4j: Setting property [conversionPattern] to [[%d{ISO8601}] %-5p %c %m %n].
log4j: Setting property [levelMax] to [DEBUG].
log4j: Setting property [levelMin] to [DEBUG].
log4j: Setting property [acceptOnMatch] to [true].
log4j: Adding filter of type [class org.apache.log4j.varia.LevelRangeFilter] to appender named [debug-out].
log4j: setFile called: logs/debug.log, true
log4j: setFile ended
..................
...................
log4j: Adding appender named [error-out] to category [root].
log4j: Class name: [org.apache.log4j.ConsoleAppender]
log4j: Setting property [target] to [System.err].
log4j: Parsing layout of class: "org.apache.log4j.PatternLayout"
log4j: Setting property [conversionPattern] to [[%d{ISO8601}] %-5p %c %m %n].
log4j: Setting property [levelMin] to [INFO].
log4j: Setting property [levelMax] to [FATAL].
log4j: Adding filter of type [class org.apache.log4j.varia.LevelRangeFilter] to appender named [console].
log4j: Adding appender named [console] to category [root].
log4j: Reading configuration from URL file:/C:/Work/test/conf/log4j.xml
log4j: Could not find root logger information. Is this OK?
log4j: Finished configuring.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

风筝在阴天搁浅。 2024-09-18 10:03:16

在 XML 配置 log4j.xml 中:

<log4j:configuration debug="true" xmlns:log4j='http://jakarta.apache.org/log4j/'>

debug 属性设置为 false

快乐的记录:-)

In the XML configuration log4j.xml:

<log4j:configuration debug="true" xmlns:log4j='http://jakarta.apache.org/log4j/'>

set the debug attribute to false.

Happy logging :-)

负佳期 2024-09-18 10:03:16

您应该添加类似于 .xml 文件的内容。

<root>
        <priority value="DEBUG"/>
        <appender-ref ref="debug-out"/>
</root>

You should add something similar to your .xml file.

<root>
        <priority value="DEBUG"/>
        <appender-ref ref="debug-out"/>
</root>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文