fix(logging): route Tomcat JULI/catalina logs to console + dotcms.log in container (#36075)#36076
fix(logging): route Tomcat JULI/catalina logs to console + dotcms.log in container (#36075)#36076wezell wants to merge 4 commits into
Conversation
… in container (#36075) In the container, only dotCMS application logs (log4j2) reached the container log stream; Tomcat's internal java.util.logging (JULI / catalina) logs went to a separate catalina.<date>.log and did not surface. Bridge raw java.util.logging into log4j2 via log4j-jul's Log4jBridgeHandler so everything except access logs is unified to console (stdout) + dotcms.log: - bom/logging/pom.xml: add managed log4j-jul dependency. - dotCMS/pom.xml: declare log4j-jul (provided) and copy its jar into the Tomcat log4j2/lib folder (already on the JVM classpath via setenv.sh). - OVERRIDE tomcat/conf/logging.properties: replace the AsyncFileHandler (catalina.<date>.log) and ConsoleHandler with Log4jBridgeHandler. Access logs (AccessLogValve) bypass JULI and remain a separate file by design. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Claude finished @wezell's task in 58s —— View job Rollback Safety Analysis
Result: ✅ Safe To RollbackThis PR makes no changes to any rollback-unsafe category. All three changed files are pure logging/build infrastructure:
Categories checked:
Rolling back from this release to the previous one would simply revert to the previous logging behavior (Tomcat JULI logs going to Label |
The jar lives on Tomcat's classpath, not the webapp classpath, so provided is the correct scope. Using runtime caused double-loading in modules that inherit the BOM without overriding the scope themselves. https://claude.ai/code/session_0137tNu61fbsugvh9KxeQLkB
🤖 Bedrock Review —
|
🤖 dotBot Review (Bedrock)Reviewed 3 file(s); 0 candidate(s) → 0 confirmed, 0 uncertain (unverified, kept for review). ✅ No issues found after verification. us.deepseek.r1-v1:0 · Run: #28270496261 · tokens: in: 11890 · out: 2876 · total: 14766 · calls: 4 · est. ~$0.032 |
Proposed Changes
Fixes #36075
In the container, only dotCMS application logs (log4j2) reached the container log stream. Tomcat's internal
java.util.logging(JULI / "catalina") logs —org.apache.catalina.*,org.apache.coyote.*— went to a separatecatalina.<date>.logand did not surface indocker logs/kubectl logs.This PR bridges raw
java.util.logginginto log4j2 vialog4j-jul'sLog4jBridgeHandler, so everything except access logs is unified to console (stdout) +dotcms.log.What changed
bom/logging/pom.xml— add managedlog4j-juldependency (${log4j.version}= 2.23.1).dotCMS/pom.xml— declarelog4j-jul(provided) and copy its jar into the Tomcatlog4j2/libfolder (already on the JVM classpath viasetenv.sh).OVERRIDE/.../tomcat/conf/logging.properties— replace the JULIAsyncFileHandler(catalina.<date>.log) +ConsoleHandlerwithorg.apache.logging.log4j.jul.Log4jBridgeHandler.Why this approach
log4j-appserver'sTomcatLogger(already bundled) only routes theorg.apache.juli.logging.Logfacade. Code logging directly viajava.util.loggingwas unbridged — this adds that bridge.Log4jBridgeHandleris the least-invasive option: it keeps Tomcat'sClassLoaderLogManagerand avoids any-Djava.util.logging.managerJVM-arg ordering risk vscatalina.sh.BasicAsyncLoggerContextSelector, set insetenv.sh) means anything reaching log4j2 lands in the existingConsole(stdout) +dotcms.logappenders.Access logs unchanged
Tomcat's
AccessLogValvewrites its own file and bypasses both JULI and the juli facade, so access logs remain a separate file by design.Testing / Verification
Built the arm64 image and ran it against Postgres; observed all four acceptance criteria:
dotcms.log(81 Tomcat-internal lines).catalina.<date>.logfile produced.dotcms_access.<date>.log).🤖 Generated with Claude Code