You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When configuring log buffering, you have options to fine-tune how logs are captured, stored, and emitted. You can configure the following parameters in the `LoggerBufferConfig` constructor:
532
532
@@ -548,9 +548,9 @@ When configuring log buffering, you have options to fine-tune how logs are captu
Use the `@logger.inject_lambda_context` decorator to automatically flush buffered logs when an uncaught exception occurs in your Lambda function. The `flush_buffer_on_uncaught_error` parameter captures and flush all buffered logs records before the Lambda execution terminates.
553
+
Use the `@logger.inject_lambda_context` decorator to automatically flush buffered logs when an exception is raised in your Lambda function. The `flush_buffer_on_uncaught_error` parameter captures and flush all buffered logs records before the Lambda execution terminates.
<i>Flushing buffer when an uncaught exception happens</i>
@@ -666,13 +668,13 @@ When using log buffering to control log emissions in your AWS Lambda functions,
666
668
667
669
1.**How can I prevent log buffering from consuming excessive memory?** Set a `max_size` in `LoggerBufferConfig` to limit the buffer's memory footprint.
668
670
669
-
2.**What happens if the log buffer reaches its maximum size?** The oldest logs are discarded when the buffer is full, making room for new logs. You need to set an appropriate `max_size` configuration.
671
+
2.**What happens if the log buffer reaches its maximum size?** The oldest logs are discarded when the buffer is full, making room for new logs. You need to set an appropriate `max_size` configuration. When this happens, we emit a warning when flushing the buffer to let you know this happened.
670
672
671
673
3.**Can I customize when logs are flushed?** Yes, use the `flush_on_error=True` in `LoggerBufferConfig` or use `flush_buffer_on_uncaught_error` in `@logger.inject_lambda_context` decorator.
672
674
673
675
4.**What timestamp is used when I flush the logs?** The timestamp preserves the original time when the log record was created. If you create a log record at 11:00:10 and flush it at 11:00:25, the log line will retain its original timestamp of 11:00:10.
674
676
675
-
5.**What happens if I try to add a log line that is bigger than max buffer size?** It will not buffer, but log as a normal log.
677
+
5.**What happens if I try to add a log line that is bigger than max buffer size?** It will not buffer, but log as a normal log and emit a warning.
676
678
677
679
6.**What happens if Lambda times out without flushing the buffer?** Buffer will be lost and no buffered logs will be flushed.
0 commit comments