-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Description
Continuing the conversation started in https://docs.google.com/document/d/1zTbS9f6s1Y8WYMhJv5lu6G1bf1ktXA-y-itc3ZOhVAA/edit?disco=AAAAAGhrT_w# : the CloudFoundry recommended way to collect HTTP access logs is to have apps dump them on stdout, in order for the loggregator to collect them. Same for tomcat info/error logs.
It would be great to have the java-buildpack support an opt-in option that configures tomcat to write access logs to stdout, with a prefix added on each line in order to distinguish these logs from app-generated logs on stdout, and catalina start logs. Tomcat error logs could end up in stderr.
Also it seems important to avoid tomcat generated logs (access and tomcat traces) mixing up with app-generated logs on stdout. Having traces interleave would make logs useless.
Some initial thoughts on how this could be implemented:
- it seems that the standard tomcat valve does not support writing to stdout.
- one could write a variant of the tomcat access log that directly writes to stdout but would then run into the race conditions on the stdout stream leading to trace interleaving
- the LogbackValve is quite attractive as it would allow to easily add the prefix to entires, control buffering, and if apps use logback to potentially avoid traces interleaving. However, embedding logback into the tomcat classpath would prevent apps from shipping their own logback version in their war. Somewhat related tomcat background might point to another tomcat-internal solution ?