Skip to content

fix(logging): POWERTOOLS_LOG_LEVEL=Trace/Debug no longer ignored#1213

Open
hjgraca wants to merge 1 commit into
developfrom
fix-log-trace-ow78i
Open

fix(logging): POWERTOOLS_LOG_LEVEL=Trace/Debug no longer ignored#1213
hjgraca wants to merge 1 commit into
developfrom
fix-log-trace-ow78i

Conversation

@hjgraca
Copy link
Copy Markdown
Contributor

@hjgraca hjgraca commented May 15, 2026

Please provide the issue number

Issue number: #1205
fixes: #1205

Summary

Changes

When no explicit MinimumLogLevel was configured (the default LogLevel.None), the Microsoft.Extensions.Logging factory kept its default minimum of Information, silently filtering Trace/Debug messages before they reached PowertoolsLoggerProvider. The provider correctly read POWERTOOLS_LOG_LEVEL from the environment and set its own minimum, but the factory-level filter had already short-circuited ILogger.IsEnabled() for Trace/Debug.

Fix: Set the factory minimum to LogLevel.Trace when no explicit level is configured, so all messages pass through to the provider which handles env-var-derived filtering.

Files changed:

  • LoggerFactoryHelper.CreateAndConfigureFactory — added else clause for MinimumLogLevel == None
  • PowertoolsLoggingBuilderExtensions.AddPowertoolsLogger — set Trace as default factory minimum

User experience

Before: Setting POWERTOOLS_LOG_LEVEL=Trace or POWERTOOLS_LOG_LEVEL=Debug had no effect — Trace and Debug calls were silently dropped. Only Information and above would emit.

After: Setting POWERTOOLS_LOG_LEVEL=Trace emits all levels (Trace, Debug, Information, Warning, Error, Critical). Setting POWERTOOLS_LOG_LEVEL=Debug emits Debug and above. All levels now work as documented.

Checklist

Please leave checklist items unchecked if they do not apply to your change.

Is this a breaking change?

RFC issue number:

Checklist:

  • Migration process documented
  • Implement warnings (if it can live side by side)

Acknowledgment

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

When no explicit MinimumLogLevel was configured, the Microsoft.Extensions.Logging
factory defaulted to Information, silently filtering Trace/Debug before they
reached the PowertoolsLoggerProvider. Set the factory minimum to Trace so the
provider's env-var-derived filtering is the single source of truth.
@boring-cyborg boring-cyborg Bot added area/logging Core logging utility tests labels May 15, 2026
@powertools-for-aws-oss-automation powertools-for-aws-oss-automation Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label May 15, 2026
@github-actions github-actions Bot added the bug Unexpected, reproducible and unintended software behaviour label May 15, 2026
@sonarqubecloud
Copy link
Copy Markdown

@codecov
Copy link
Copy Markdown

codecov Bot commented May 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.46%. Comparing base (7754dd4) to head (a512d6d).
⚠️ Report is 28 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1213      +/-   ##
===========================================
+ Coverage    79.42%   79.46%   +0.03%     
===========================================
  Files          302      302              
  Lines        12654    12662       +8     
  Branches      1507     1507              
===========================================
+ Hits         10051    10062      +11     
+ Misses        2145     2142       -3     
  Partials       458      458              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@hjgraca hjgraca requested a review from leandrodamascena May 15, 2026 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/logging Core logging utility bug Unexpected, reproducible and unintended software behaviour size/L Denotes a PR that changes 100-499 lines, ignoring generated files. tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: POWERTOOLS_LOG_LEVEL=Trace or Debug is ignored — Trace/Debug calls never emit

1 participant