Skip to content

server: add --fine-grain-log-levels CLI argument for startup log verbosity#44067

Open
Retr0-XD wants to merge 1 commit intoenvoyproxy:mainfrom
Retr0-XD:feat/fine-grain-log-cli-arg-41028
Open

server: add --fine-grain-log-levels CLI argument for startup log verbosity#44067
Retr0-XD wants to merge 1 commit intoenvoyproxy:mainfrom
Retr0-XD:feat/fine-grain-log-cli-arg-41028

Conversation

@Retr0-XD
Copy link

@Retr0-XD Retr0-XD commented Mar 21, 2026

Description

Closes #41028

Currently, fine-grain logging (per-source-file log level control) can only be configured at runtime via the admin API. This is inconvenient for containerized deployments (e.g. Kubernetes) where users want file-level log verbosity from startup without admin access.

This PR adds --fine-grain-log-levels as a startup CLI argument that accepts a comma-separated list of glob:level pairs, mirroring the format already supported by the admin /logging?paths=… endpoint.

Example usage

envoy --enable-fine-grain-logging \
      --fine-grain-log-levels "*filter*:debug,source/common/common/*:trace"

Glob patterns follow the existing FineGrainLogContext::safeFileNameMatch semantics:

  • Patterns without / are matched against the base filename only.
  • Patterns with / are matched against the full source path.

Changes

File Change
envoy/server/options.h Added fineGrainLogLevels() PURE virtual method
source/server/options_impl_base.h Added fine_grain_log_levels_ member + accessor
source/server/options_impl.cc Added --fine-grain-log-levels TCLAP arg + parseFineGrainLogLevels()
source/server/options_impl.h Declared parseFineGrainLogLevels()
source/exe/main_common.cc Applied levels via getFineGrainLogContext().updateVerbositySetting() at startup
api/envoy/admin/v3/server_info.proto Added fine_grain_log_levels field (field 43)
test/mocks/server/options.h Mocked fineGrainLogLevels()
test/server/options_impl_test.cc Added 4 new tests

Risk

Low. The flag is completely opt-in — it is a no-op unless --enable-fine-grain-logging is also set, and it calls the same updateVerbositySetting API already used by the admin endpoint.

AI disclosure: GitHub Copilot was used during implementation and test writing. I fully understand all changes made in this PR.

Commit Message: See PR title
Risk Level: Low
Testing: Unit tests added/verified
Docs Changes: N/A
Release Notes: N/A
Platform Specific Features: N/A

@Retr0-XD Retr0-XD had a problem deploying to external-contributors March 21, 2026 10:16 — with GitHub Actions Error
@repokitteh-read-only
Copy link

Hi @Retr0-XD, welcome and thank you for your contribution.

We will try to review your Pull Request as quickly as possible.

In the meantime, please take a look at the contribution guidelines if you have not done so already.

🐱

Caused by: #44067 was opened by Retr0-XD.

see: more, trace.

@repokitteh-read-only
Copy link

CC @envoyproxy/api-shepherds: Your approval is needed for changes made to (api/envoy/|docs/root/api-docs/).
envoyproxy/api-shepherds assignee is @adisuissa
CC @envoyproxy/api-watchers: FYI only for changes made to (api/envoy/|docs/root/api-docs/).

🐱

Caused by: #44067 was opened by Retr0-XD.

see: more, trace.

@agrawroh
Copy link
Member

@Retr0-XD Please fix the DCO.

/wait

@Retr0-XD
Copy link
Author

@Retr0-XD Please fix the DCO.

/wait

Added DCO

Allow configuring per-file log levels (glob:level pairs) at startup
when --enable-fine-grain-logging is set, similar to --component-log-level.

Fixes envoyproxy#41028

Signed-off-by: Retr0-XD <sakthi.harish@edgeverve.com>
@Retr0-XD Retr0-XD force-pushed the feat/fine-grain-log-cli-arg-41028 branch from 8ff12d4 to 20992b5 Compare March 22, 2026 06:08
@Retr0-XD Retr0-XD requested a deployment to external-contributors March 22, 2026 06:08 — with GitHub Actions Waiting
Copy link
Contributor

@adisuissa adisuissa left a comment

Choose a reason for hiding this comment

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

/lgtm api

// See :option:`--enable-fine-grain-logging` for details.
bool enable_fine_grain_logging = 34;

// See :option:`--fine-grain-log-levels` for details.
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it require --enable-fine-grain-logging to work?

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, I see that the code below requires that. nvm.

@adisuissa
Copy link
Contributor

Assigning @botengyao as code-owner
/assign @botengyao

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.

Allow fine-grain logging to be configurable via CLI arguments

4 participants