tomcattomcat7tomcat-valve

Can you set Tomcat’s access log directory dynamically?


I am trying to know if it’s possible to have a per-month access log directory in Tomcat 7. After having read the access log Valve documentation it doesn’t seem like it.

Ideally, it would be something similar to this:

<Valve ...
    directory="logs/%d{YYYY-MM}/${tomcat.hostname}"
    ...
/>

Are there any variables that can be set to achieve this?


Solution

  • I don't know of a way to do that with Tomcat. But if you use logrotate to rotate the logs, instead of letting Tomcat do it, then you have many more options.