-
Notifications
You must be signed in to change notification settings - Fork 97
feat(logging): Log buffering support for Logj42 and Logback #2103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
phipag
wants to merge
46
commits into
main
Choose a base branch
from
phipag/issue2095
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…or option to Logging aspect.
…ause we configured two appenders as proxies.
…to avoid circular dependency when flushing buffer on error.
svozza
reviewed
Sep 3, 2025
Co-authored-by: Stefano Vozza <svozza@gmail.com>
Co-authored-by: Stefano Vozza <svozza@gmail.com>
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
feature-parity
Feature parity with python version
feature-request
New feature or request
logger
size/XXL
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Docs preview: https://dealn7fl31ram.cloudfront.net/core/logging/#buffering-logs
This PR introduces a log buffering feature to Powertools for AWS Lambda (Java). Log buffering is the mechanism of buffering lower level logs and only flush them (to STDOUT on Lambda) in case of error or manually if needed. It is a good way to reduce the noise caused by e.g. DEBUG logs and can be seen as a more elaborate way of "log sampling".
While the other Powertools runtimes (Python, TypeScript, .NET) follow a programmatic approach to configuring log buffering, this PR uses the concept of "Appenders" in the corresponding logging backend (log4j2, logback). This means that log buffering is configured using the configuration files of the respective logging framework which is compatible with the way how structured JSON logging is already implemented. This also means that log buffering can be used independent of the
@Logging
annotation (except for automatic flushing on exceptions) and it is also compatible with any other Appender. The idea is to wrap an arbitrary existing Appender (e.g. a STDOUT JSON structured appender) with theBufferingAppender
which will enable log buffering with zero code changes. Here is an example for log4j2:Note: This XML based configuration supersedes the original design proposal of
@BufferingConfig
made in the feature request issue (see below).Changes
Issue number: #2095
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.