Skip to content

Add support for outputing access, stdout, and tomcat logs to loggregator #30

@gberche-orange

Description

@gberche-orange

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 ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions