[英]Set relative path for LogBack Appender
Is there a way to set a relative path for a Layout configuration in logback? 有没有办法在logback中为Layout配置设置相对路径?
<configuration debug="true">
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
<layout class="ch.qos.logback.classic.html.HTMLLayout">
<pattern>%relative%thread%mdc%level%logger%msg</pattern>
<cssBuilder class="ch.qos.logback.classic.html.UrlCssBuilder">
<url>http://localhost:8080/myProject/resources/css/main.css</url>
</cssBuilder>
</layout>
</encoder>
<file>F:/Projects/myProject/src/main/webapp/test.html</file>
</appender>
<root level="DEBUG">
<appender-ref ref="FILE" />
</root>
</configuration>
I would like to set the <file>
to a relative path. 我想将<file>
设置为相对路径。 Is there a way to put it into the webapp or WEB-INF folder? 有没有办法将其放入webapp或WEB-INF文件夹? The same for the CSS CSS也一样
I saw this for Jetty (I did not try it myself): 我为Jetty看到了这一点(我自己没有尝试过):
<file>\${jetty.home}/logs/jetty.log</file>
and tried this for Tomcat 8 (which worked): 并针对Tomcat 8进行了尝试(有效):
<file>${catalina.base}/logs/whatever.log</file>
You might find this helpful, but still need to craft the path under webapps manually... 您可能会发现这很有用,但仍然需要手动在webapps下制作路径...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.