According to the docs, it should be possible to use an absolute path for the accesslog.
Specifying server.tomcat.accesslog.directory: /dev/logs
is treated as a relative path to tomcat.basedir
yet (at least on Windows). I expected to find access logs in c:\dev\logs
in this example.
Fixing that would align accesslog path treatment with application logs (logging.file.name: /dev/logs/app.log
is treated as an absolute path, i.e. c:\dev\logs\app.log
on Windows).
Comment From: wilkinsona
Tomcat will use the directory as-is if File
considers it to be absolute: https://github.com/apache/tomcat/blob/7977440111f96ccbfea039b913fd1744ea5867cb/java/org/apache/catalina/valves/AccessLogValve.java#L487. Having you tried setting it to c:\dev\logs
?
Comment From: elab
Yes, I tried, and it works of course. But it would be much more convenient to be able to specify paths in OS-independent way, as in other path-related settings in Spring Boot application properties.
Comment From: wilkinsona
Unfortunately, I don't thinks that's possible. On Windows, the JVM doesn't consider /dev/logs
to be absolute – new File("/dev/logs/").isAbsolute()
returns false
. Tomcat's behaviour is to prefix any non-absolute path with the configured basedir while Logback's behaviour is to use the path as-is. Even assuming that we were able to change Tomcat's behaviour, doing so could break existing configuration as the basedir would be ignored when it previously was not.