Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emit Tomcat HTTP logs to stdout from Docker #1

Merged
merged 1 commit into from
Nov 23, 2023

Conversation

mbland
Copy link
Owner

@mbland mbland commented Nov 23, 2023

I'm starting to push updates as pull requests to make sure the GitHub Actions run as expected on pull requests and merges.

Tomcat emits its own startup and shutdown logs by default, but also emits HTTP access logs to logs/localhost_access_log.YYYY-MM-DD.txt. This dynamically rewrites the conf/server.xml file to emit the HTTP logs to standard output instead.

As mentioned in the update-tomcat-logging-config.sh comment, this configuration was inspired by:

Got the Perl implementation hint from:

Also updates the Dockerfile FROM from tomcat:10.1.16-jdk21-temurin-jammy to tomcat:10.1.16-jre21-temurin-jammy. The former was 211.56 MB compressed/454MB uncompressed, the latter 111.28 MB compressed/310MB uncompressed.

Tomcat emits its own startup and shutdown logs by default, but also
emits HTTP access logs to logs/localhost_access_log.YYYY-MM-DD.txt. This
dynamically rewrites the conf/server.xml file to emit the HTTP logs to
standard output instead.

As mentioned in the update-tomcat-logging-config.sh comment, this
configuration was inspired by:

- https://stackoverflow.com/a/62598943

Got the Perl implementation hint from:

- https://unix.stackexchange.com/a/26289
- https://unix.stackexchange.com/a/181215

Also updates the Dockerfile FROM from tomcat:10.1.16-jdk21-temurin-jammy
to tomcat:10.1.16-jre21-temurin-jammy. The former was 211.56 MB
compressed/454MB uncompressed, the latter 111.28 MB compressed/310MB
uncompressed.

- https://hub.docker.com/layers/library/tomcat/10.1.16-jdk21-temurin-jammy/images/sha256-857b168692495ee6ff0d6ee89b5b479555c74401bc3c219c88644b9181f03dd5?context=explore
- https://hub.docker.com/layers/library/tomcat/10.1.16-jre21-temurin-jammy/images/sha256-7aaaf9a602c7160a644f1aa5cb1a42c584879769d9b78ef9e31f1055f392561a?context=explore
@mbland mbland self-assigned this Nov 23, 2023
@mbland mbland merged commit 1572010 into main Nov 23, 2023
5 checks passed
@mbland mbland deleted the tomcat-access-logs-stdout branch November 23, 2023 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant