Skip to content

Fix external loggers respecting configured format - #7699

Open
Rohithmatham12 wants to merge 3 commits into
cortexproject:masterfrom
Rohithmatham12:fix-json-log-format-external-loggers
Open

Fix external loggers respecting configured format#7699
Rohithmatham12 wants to merge 3 commits into
cortexproject:masterfrom
Rohithmatham12:fix-json-log-format-external-loggers

Conversation

@Rohithmatham12

@Rohithmatham12 Rohithmatham12 commented Jul 18, 2026

Copy link
Copy Markdown

What this changes

  • Routes gRPC package-level logs through the configured Cortex go-kit logger so transport errors respect server.log_format.
  • Replaces the side-effect automaxprocs import with explicit maxprocs.Set(...) after Cortex initializes logging, so maxprocs messages also use the configured format.
  • Preserves gRPC default severity behavior: errors only unless GRPC_GO_LOG_SEVERITY_LEVEL asks for warning/info.
  • Adds focused tests for gRPC and automaxprocs log output through the configured JSON logger.

Fixes #7697.

Testing

  • GOCACHE=/private/tmp/cortex-go-cache GOMODCACHE=/private/tmp/cortex-go-mod-cache go test ./pkg/util/log
  • GOCACHE=/private/tmp/cortex-go-cache GOMODCACHE=/private/tmp/cortex-go-mod-cache go test ./cmd/cortex

@dosubot dosubot Bot added go Pull requests that update Go code type/chore Something that needs to be done; not a bug or a feature labels Jul 18, 2026
Signed-off-by: Rohithmatham12 <rohithmatham@gmail.com>
@Rohithmatham12
Rohithmatham12 force-pushed the fix-json-log-format-external-loggers branch from e0e6dac to 9999625 Compare July 18, 2026 17:15
Signed-off-by: Rohithmatham12 <rohithmatham@gmail.com>
@Rohithmatham12
Rohithmatham12 force-pushed the fix-json-log-format-external-loggers branch from 1fb1c7c to 9a62f5d Compare August 5, 2026 05:09
Signed-off-by: Rohithmatham12 <rohithmatham@gmail.com>
@Rohithmatham12
Rohithmatham12 force-pushed the fix-json-log-format-external-loggers branch from 9a62f5d to 1497c2d Compare August 5, 2026 17:40

@friedrichg friedrichg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I am not sure the automaxprocs package is needed after 1.26.
There is conflicting information uber-go/automaxprocs#98 (comment)

we can decide later after some testing


@Rohithmatham12 good work though

@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

go Pull requests that update Go code lgtm This PR has been approved by a maintainer size/L type/chore Something that needs to be done; not a bug or a feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Some logs ignore the JSON log format setting

2 participants