[英]log4j.xml configuration is not storing logs to file
I have the following log4j.xml configuration file, but don't see the log data stored in the file specified (in my documents folder: Documents/debug.log
).我有以下 log4j.xml 配置文件,但没有看到存储在指定文件中的日志数据(在我的文档文件夹中: Documents/debug.log
)。
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"
debug="true">
<appender name="applicationLogFile" class="org.apache.log4j.RollingFileAppender">
<param name="DatePattern" value="'.'yyyyMMdd'.log'" />
<param name="File" value="Documents/debug.log" />
<param name="threshold" value="TRACE" />
<param name="MaxNumberOfDays" value="90"/>
<param name="CompressBackups" value="TRUE"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{ISO8601} %-5p [%c] %m%n" />
</layout>
</appender>
<logger name="APP_VERSION_LOGGER">
<appender-ref ref="applicationVersionFile" />
</logger>
<logger name="org.springframework">
<level value="WARN" />
</logger>
<root>
<priority value="DEBUG" />
<appender-ref ref="applicationLogFile" />
<appender-ref ref="bmcAlertFile" />
</root>
</log4j:configuration>
How an I get my log data sent to my Documents
directory on my computer?如何将我的日志数据发送到我计算机上的Documents
目录? I'm using log4j-core
version 2.13.3
.我正在使用log4j-core
版本2.13.3
。 And yes, I've looke at the docs, but I still don't see where my log data is going.是的,我已经查看了文档,但我仍然看不到我的日志数据的去向。
Your line here says:你这里的台词说:
<param name="File" value="Documents/debug.log" />
It will make a folder with name Documents
on your project root level and logs will be there.它将在您的项目根级别创建一个名为Documents
的文件夹,并且日志将在那里。
I f you want to put them in to specific location on your machine then you need to provide full pathname.如果你想把它们放在你机器上的特定位置,那么你需要提供完整的路径名。 ex.前任。
<param name="File" value="/Users/myUser/Documents/debug.log" />
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.