Skip to content

Conversation

kattakaha
Copy link
Contributor

Issue number: closes #7220

Summary

Changes

This PR addresses documentation improvements for AWS Lambda Advanced Logging Controls (ALC) interaction with Powertools Logger sampling functionality. The changes clarify how Lambda's log level settings override Powertools configuration and provide clear guidance to avoid confusion.

Based on review feedback from @leandrodamascena in PR #7412:

  • Enhanced CDK example wording to be more precise about Lambda setting the environment variable
  • Added ALC reference in sampling introduction section instead of separate warning block to avoid page clutter
  • Maintained clear priority order examples showing how Lambda's log level takes precedence

User experience

Before: Users were confused about the interaction between Lambda's Advanced Logging Controls and Powertools sampling settings, leading to unexpected behavior where sampling didn't work as expected when ALC was set to DEBUG level.

After: Users have clear documentation explaining:

  • How Lambda's log level settings override Powertools configuration
  • Why sampling may not work when ALC is set to DEBUG
  • How CDK's applicationLogLevelV2 automatically sets AWS_LAMBDA_LOG_LEVEL
  • The priority order of log level settings with concrete examples

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.

@kattakaha kattakaha requested a review from a team as a code owner September 26, 2025 10:54
@pull-request-size pull-request-size bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Sep 26, 2025
@boring-cyborg boring-cyborg bot added the documentation Improvements or additions to documentation label Sep 26, 2025
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR improves documentation clarity around AWS Lambda Advanced Logging Controls (ALC) interaction with Powertools Logger sampling functionality. The changes address user confusion about when Lambda's log level settings override Powertools configuration, potentially causing unexpected sampling behavior.

Key changes:

  • Added detailed explanation of CDK applicationLogLevelV2 parameter behavior in log level priority section
  • Added reference to ALC interaction within the sampling introduction section
  • Clarified how Lambda automatically sets AWS_LAMBDA_LOG_LEVEL environment variable

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Contributor

@leandrodamascena leandrodamascena left a comment

Choose a reason for hiding this comment

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

Hey @kattakaha! Can you please only incorporate this small change and then we merge?

dfc8509#diff-e42af4aee30a146e6e51be432c4a80c93e50d552f7b70403fa301ecf11d355c4R378

@kattakaha
Copy link
Contributor Author

@leandrodamascena Sorry for missing that change in the new PR! I've now added the broken ALC documentation link fix as requested. Thanks for your patience with the multiple iterations.

Copy link

Copy link
Contributor

@leandrodamascena leandrodamascena left a comment

Choose a reason for hiding this comment

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

Thanks for working on this @kattakaha! APPROVED!

@leandrodamascena leandrodamascena merged commit b8d52d2 into aws-powertools:develop Sep 26, 2025
8 checks passed
@kattakaha kattakaha deleted the fix/docs/logger#7220-v2 branch September 26, 2025 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Conflict between POWERTOOLS_LOG_LEVEL and Lambda applicationLogLevelV2

2 participants