Closed
Description
Use case
On exceptions within the Logging framework code, currently, it throws an exception and brings down the whole application.
For example below is a code that has a mismatch count of parameters passed to the log message - Missing Count
property value being passed in.
Logger.LogInformation(extraKeys, "Retrieved data for city {cityName} with count {Count}", new[] { cityName });
It throws an exception and causes the Lambda Handler endpoint to crash and return a 500 Internal Server Error
System.IndexOutOfRangeException: Index was outside the bounds of the array.
at Microsoft.Extensions.Logging.LogValuesFormatter.GetValue(Object[] values, Int32 index)
at Microsoft.Extensions.Logging.FormattedLogValues.get_Item(Int32 index)
at Microsoft.Extensions.Logging.FormattedLogValues.GetEnumerator()+MoveNext(
Solution/User Experience
On exceptions within the logging framework, it should gracefully handle this without causing the application to crash. A similar approach is taken by other popular libraries in this space (e.g Serilog)
Alternative solutions
No response
Acknowledgment
- This feature request meets Powertools for AWS Lambda (.NET) Tenets
- Should this be considered in other Powertools for AWS Lambda languages? i.e. Python, Java, and TypeScript
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
👀 In review