Skip to content

Add --log-timestamp-utc flag for UTC log timestamps#8915

Closed
frederik12321 wants to merge 1 commit into
sigp:unstablefrom
frederik12321:fix/log-timestamp-utc
Closed

Add --log-timestamp-utc flag for UTC log timestamps#8915
frederik12321 wants to merge 1 commit into
sigp:unstablefrom
frederik12321:fix/log-timestamp-utc

Conversation

@frederik12321

Copy link
Copy Markdown

Summary

Closes #3130

  • Adds a --log-timestamp-utc CLI flag that switches text log timestamps from local time to UTC
  • After the tracing migration (PR Tracing cleanup #7168), text logs default to local time (Local::now()), which resolved the original complaint about forced UTC
  • This flag gives operators who prefer UTC (for slot comparison against tools like slots.symphonious.net, or multi-timezone debugging) an explicit opt-in
  • JSON log timestamps remain UTC (Utc::now() with RFC3339 format) regardless of this flag

Implementation

Threads a log_timestamp_utc: bool field through LoggerConfiginit_tracing()LoggingLayer. When the flag is set, on_event() uses Utc::now() instead of Local::now() for the text format timestamp.

SSE and libp2p/discv5 logging layers are left unchanged (local time) as they serve the GUI and internal debugging respectively.

Test plan

  • cargo check passes with zero errors/warnings
  • cargo fmt --all produces no diffs
  • make lint (clippy) passes with zero warnings
  • Manual: run lighthouse bn --log-timestamp-utc and verify timestamps show UTC
  • Manual: run without flag and verify timestamps show local time (existing behavior)

🤖 Generated with Claude Code

@cla-assistant

cla-assistant Bot commented Feb 28, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


frederik seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@cla-assistant

cla-assistant Bot commented Feb 28, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Frederik seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

Add a `--log-timestamp-utc` CLI flag that switches text log
timestamps from local time to UTC. After the tracing migration,
text logs default to local time, which resolved the original
complaint. This flag gives operators who prefer UTC (for slot
comparison or multi-timezone debugging) an explicit opt-in.

JSON log timestamps remain UTC regardless of this flag.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@frederik12321

Copy link
Copy Markdown
Author

Closing this PR — same reason as #8913 and #8914.

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