Can Tomcat’s AccessLogValve use a per‑host time zone?
0 reputation · 18 Oct 2025, 06:17 UTC
Goal
In a multi‑region deployment we want each host’s access log to record timestamps in the local zone of that host, rather than inheriting the JVM default. This would simplify correlation of logs across data centers and avoid the need to adjust for daylight‑saving changes on a per‑host basis.
Current Constraints
The AccessLogValve in Tomcat 9 and 10 renders timestamps using java.util.Date in the JVM’s default time zone. The server.xml configuration offers no timezone attribute or equivalent for the valve. Changing -Duser.timezone affects the entire container and all applications, not just logging.
Uncertainty
There is no documented per‑host or per‑context time‑zone setting for the valve, and no open issue indicates that such a feature will be added in upcoming releases. If it were introduced, would it override the JVM default only for the valve, or would it also affect other time‑dependent components?
Specific Questions
- Does Tomcat provide any mechanism—current or planned—to configure the AccessLogValve timestamp zone independently of the JVM default?
- If not, what are the recommended workarounds for per‑host time‑zone logging without globally changing
user.timezone? - How would a per‑host time‑zone setting interact with other Tomcat features that rely on the JVM default, such as session expiration or cookie handling?