Recently I've started to work with Spring Boot and have a following question:
We have different environments (like stage, development, production) and all of them can be run on windows or linux. So I've created application-stage.properties, application-prod.properties, application-devl.properties to specify stuff like db connections and so on because its OS agnostic (the same for windows and linux).
Now I would like to enable access logs for embedded Tomcat server.
So following various guides I used the following in my application.properties
file:
server.tomcat.accesslog.directory=logs
server.tomcat.accesslog.enabled=true
I was forced to specify a relative path because we use both linux and windows, however I would like the access log to be created in different places depending on the OS .
For example, we store logs in windows under c:\<product>\logs
and in linux we use /var/log/<product>/...
For usual logs we use logbacks and it allows stuff like this, but since access log is not actually logback driven and instead uses Valves, my question is: how we can achieve the same level of flexibility here?
I don't think I should provide additional profile for this and use it like:
--spring.profiles.active=windows / linux
Because I believe spring boot has some solution up on its sleeves for this :) Thanks a lot in advance