server: add --fine-grain-log-levels CLI argument for startup log verbosity#44067
server: add --fine-grain-log-levels CLI argument for startup log verbosity#44067Retr0-XD wants to merge 1 commit intoenvoyproxy:mainfrom
Conversation
|
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. |
|
CC @envoyproxy/api-shepherds: Your approval is needed for changes made to |
|
@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>
8ff12d4 to
20992b5
Compare
| // See :option:`--enable-fine-grain-logging` for details. | ||
| bool enable_fine_grain_logging = 34; | ||
|
|
||
| // See :option:`--fine-grain-log-levels` for details. |
There was a problem hiding this comment.
Does it require --enable-fine-grain-logging to work?
There was a problem hiding this comment.
Oh, I see that the code below requires that. nvm.
|
Assigning @botengyao as code-owner |
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-levelsas a startup CLI argument that accepts a comma-separated list ofglob:levelpairs, 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::safeFileNameMatchsemantics:/are matched against the base filename only./are matched against the full source path.Changes
envoy/server/options.hfineGrainLogLevels()PURE virtual methodsource/server/options_impl_base.hfine_grain_log_levels_member + accessorsource/server/options_impl.cc--fine-grain-log-levelsTCLAP arg +parseFineGrainLogLevels()source/server/options_impl.hparseFineGrainLogLevels()source/exe/main_common.ccgetFineGrainLogContext().updateVerbositySetting()at startupapi/envoy/admin/v3/server_info.protofine_grain_log_levelsfield (field 43)test/mocks/server/options.hfineGrainLogLevels()test/server/options_impl_test.ccRisk
Low. The flag is completely opt-in — it is a no-op unless
--enable-fine-grain-loggingis also set, and it calls the sameupdateVerbositySettingAPI 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