fix: apply log level/format before NewRunner() emits startup logs#1192
Open
ucpr wants to merge 1 commit into
Open
fix: apply log level/format before NewRunner() emits startup logs#1192ucpr wants to merge 1 commit into
ucpr wants to merge 1 commit into
Conversation
Signed-off-by: ucpr <contact@ucpr.dev>
ucpr
force-pushed
the
fix/log-format-before-runner-init
branch
from
July 16, 2026 05:53
45f5de5 to
fd7ec83
Compare
ucpr
marked this pull request as ready for review
July 16, 2026 05:56
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When LOG_FORMAT=json was set, startup logs emitted before the logger configuration was applied used logrus’s default text formatter.
This affected Stats-related logs emitted from NewRunner() and tracing initialization logs emitted early in Run(). Logs emitted later, such as the Redis connection log, used the configured JSON formatter. As a result, a single process produced logs in inconsistent formats.
Fix
Extracted the logger level/format configuration into
configureLogger()and call it at the top ofNewRunner(), so it's applied before any log line is emitted, including those insideNewRunner()itself. Removed the now-duplicated configuration code fromRun().Note: #428 was a prior attempt at the same root cause, but it only reordered the
TracerProvider initializedlog insideRun()and didn't address the Stats-related logs emitted fromNewRunner(). It went unreviewed and was stale-closed. This PR covers both.Test plan
go build ./...go test ./src/...LOG_FORMAT=jsonand confirmed all startup logs (Stats initialized / Stats flush interval / Tracing disabled / etc.) are now emitted as JSON