Skip to content

Add timestamps to management, server and agent .err logs#12967

Open
dheeraj12347 wants to merge 1 commit intoapache:mainfrom
dheeraj12347:fix-12887-err-timestamps-clean
Open

Add timestamps to management, server and agent .err logs#12967
dheeraj12347 wants to merge 1 commit intoapache:mainfrom
dheeraj12347:fix-12887-err-timestamps-clean

Conversation

@dheeraj12347
Copy link
Copy Markdown
Contributor

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.

@dheeraj12347
Copy link
Copy Markdown
Contributor Author

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.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 the CONSOLE appender PatternLayout in 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
Copy link
Copy Markdown

codecov bot commented Apr 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 18.00%. Comparing base (e2d18c0) to head (45c3bbe).
⚠️ Report is 1 commits behind head on main.

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     
Flag Coverage Δ
uitests 3.52% <ø> (ø)
unittests 19.17% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@DaanHoogland DaanHoogland requested a review from Copilot April 8, 2026 14:45
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines 65 to 68
<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>
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines 70 to 73
<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>
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copilot uses AI. Check for mistakes.
Comment on lines 40 to 43
<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>
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.err logs have no timestamp

2 participants