[英]Is it possible to write a log into scr/main/resources in logback?
I have a logback appender: 我有一个logback追加器:
<appender name="logfile"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>/opt/loghome/recon/log.%d{MM-dd-yyyy}.log </fileNamePattern>
<maxHistory>30</maxHistory>
</rollingPolicy>
<append>false</append>
<encoder>
<pattern>%msg%n</pattern>
</encoder>
</appender>
I would like to change /opt/loghome/recon/log.%d{MM-dd-yyyy}.log.zip
so that the log will be created in src/main/resources in my project. 我想更改
/opt/loghome/recon/log.%d{MM-dd-yyyy}.log.zip
以便在项目的src / main / resources中创建日志。 The aim of this is to then have the log on the classpath. 这样的目的是使日志记录在类路径上。 Can this be done?
能做到吗?
Thanks 谢谢
I guess you're using maven. 我猜你在用Maven。 Maven builds jars/wars/ears whatever The jars don't contain src/main/resources In fact this src/main/resources path doesn't exist once your project is compiled.
Maven可以构建jars / wars / ears jars不包含src / main / resources实际上,一旦编译项目,此src / main / resources路径就不存在。 So I don't really get this idea to put your logs into src/main/resources.
因此,我真的不知道将您的日志放入src / main / resources。
I think its much more "healthy" to include your /opt/loghome/recon/ in the classpath when you're running your project. 我认为在运行项目时将/ opt / loghome / recon /包含在类路径中更为“健康”。
Does it make sense? 是否有意义?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.