Is there a way to set a relative path for a Layout configuration in logback?
<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. Is there a way to put it into the webapp or WEB-INF folder? The same for the CSS
I saw this for Jetty (I did not try it myself):
<file>\${jetty.home}/logs/jetty.log</file>
and tried this for Tomcat 8 (which worked):
<file>${catalina.base}/logs/whatever.log</file>
You might find this helpful, but still need to craft the path under webapps manually...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With