Skip to content

Commit c147b01

Browse files
committed
Clarify log buffering log level configuration with upper and lower bound example.
1 parent 2d20f75 commit c147b01

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

docs/core/logging.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -881,12 +881,12 @@ When configuring log buffering, you have options to fine-tune how logs are captu
881881
| `flushOnErrorLog` | Automatically flush buffer when `ERROR` or `FATAL` level logs are emitted | `true` (default), `false` |
882882

883883
!!! warning "Logger Level Configuration"
884-
To use log buffering effectively, you must set your logger levels to the most verbose level (`DEBUG`) so that all logs can be captured by the `BufferingAppender`. The `BufferingAppender` then decides which logs to buffer based on the `bufferAtVerbosity` setting.
885-
884+
To use log buffering effectively, you must set your logger levels to the same level as `bufferAtVerbosity` or more verbose for the logging framework to capture and forward logs to the `BufferingAppender`. For example, if you want to buffer `DEBUG` level logs and emit `INFO`+ level logs directly, you must:
885+
886886
- Set your logger levels to `DEBUG` in your log4j2.xml or logback.xml configuration
887887
- Set `POWERTOOLS_LOG_LEVEL=DEBUG` if using the environment variable (see [Log level](#log-level) section for more details)
888-
889-
This ensures that all log levels (`DEBUG`, `INFO`, `WARN`) are forwarded to the `BufferingAppender` for it to selectively buffer or emit directly.
888+
889+
If you want to sample `INFO` and `WARNING` logs but not `DEBUG` logs, set your log level to `INFO` and `bufferAtVerbosity` to `WARNING`. This allows you to define the lower and upper bounds for buffering. All logs with a more severe level than `bufferAtVerbosity` will be emitted directly.
890890

891891
=== "log4j2.xml - Buffer at WARNING level"
892892

0 commit comments

Comments
 (0)