Add timestamps to management, server and agent .err logs#12967
Add timestamps to management, server and agent .err logs#12967dheeraj12347 wants to merge 1 commit intoapache:mainfrom
Conversation
|
This is a replacement for PR #12896 with the same .err timestamp change, but scoped to only the three log4j config files and based on the latest main. |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Updates Log4j2 console appender patterns to include timestamps so systemd-captured console/stderr .err logs are timestamped and aligned with existing rolling file logs (per #12887).
Changes:
- Prepended
%d{DEFAULT}to theCONSOLEappenderPatternLayoutin client, server, and agent configs. - Minor cleanup: removed a few blank/whitespace-only lines in the XML configs.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| server/conf/log4j-cloud.xml.in | Adds timestamp to console log pattern; minor whitespace cleanup. |
| client/conf/log4j-cloud.xml.in | Adds timestamp to console log pattern; minor whitespace cleanup. |
| agent/conf/log4j-cloud.xml.in | Adds timestamp to console log pattern; removes extra blank lines between logger entries. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #12967 +/- ##
============================================
- Coverage 18.00% 18.00% -0.01%
+ Complexity 16464 16463 -1
============================================
Files 5977 5977
Lines 537726 537726
Branches 66026 66026
============================================
- Hits 96839 96831 -8
- Misses 429968 429975 +7
- Partials 10919 10920 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| <Console name="CONSOLE" target="SYSTEM_OUT"> | ||
| <ThresholdFilter level="OFF" onMatch="ACCEPT" onMismatch="DENY"/> | ||
| <PatternLayout pattern="%-5p [%c{1.}] (%t:%x) %m%ex%n"/> | ||
| <PatternLayout pattern="%d{DEFAULT} %-5p [%c{1.}] (%t:%x) %m%ex%n"/> | ||
| </Console> |
There was a problem hiding this comment.
The PR description says the .err logs are fed from console/stderr, but this Console appender targets SYSTEM_OUT. If systemd is capturing stderr into .err, changing the stdout pattern won’t affect .err. Consider switching the console target to SYSTEM_ERR (or update the systemd unit routing) so the timestamped console output actually lands in .err.
| <Console name="CONSOLE" target="SYSTEM_OUT"> | ||
| <ThresholdFilter level="OFF" onMatch="ACCEPT" onMismatch="DENY"/> | ||
| <PatternLayout pattern="%-5p [%c{1.}] (%t:%x) (logid:%X{logcontextid}) %m%ex{filters(${filters})}%n"/> | ||
| <PatternLayout pattern="%d{DEFAULT} %-5p [%c{1.}] (%t:%x) (logid:%X{logcontextid}) %m%ex{filters(${filters})}%n"/> | ||
| </Console> |
There was a problem hiding this comment.
Same as server: the description references stderr->.err, but the console appender is configured for SYSTEM_OUT. If .err is populated from stderr, the timestamped pattern won’t be reflected there unless the target is SYSTEM_ERR (or the unit routes stdout to .err).
| <Console name="CONSOLE" target="SYSTEM_OUT"> | ||
| <ThresholdFilter level="OFF" onMatch="ACCEPT" onMismatch="DENY"/> | ||
| <PatternLayout pattern="%-5p [%c{3}] (%t:%x) (logid:%X{logcontextid}) %m%ex%n"/> | ||
| <PatternLayout pattern="%d{DEFAULT} %-5p [%c{3}] (%t:%x) (logid:%X{logcontextid}) %m%ex%n"/> | ||
| </Console> |
There was a problem hiding this comment.
Same concern here: if .err is sourced from stderr as stated in the PR description, this console appender targeting SYSTEM_OUT won’t influence .err formatting. Consider using target=\"SYSTEM_ERR\" (or aligning systemd routing) to ensure .err lines include the new timestamp.
This change updates the CONSOLE appender PatternLayout in:
client/conf/log4j-cloud.xml.in
server/conf/log4j-cloud.xml.in
agent/conf/log4j-cloud.xml.in
The console patterns now include %d{DEFAULT} at the beginning, matching the existing rolling file appender patterns. This ensures .err log lines (fed from console/stderr by the systemd units) include timestamps, which improves troubleshooting and aligns .err with .log, as requested in issue #12887.
Hyper-V’s log4j-cloud.xml.in already uses a timestamped console pattern and is unchanged.
Fixes #12887.