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
usingAmazon.Lambda.Core;usingAWS.Lambda.Powertools.Logging;// Assembly attribute to enable the Lambda function's JSON input to be converted into a .NET class.[assembly:LambdaSerializer(typeof(Amazon.Lambda.Serialization.SystemTextJson.DefaultLambdaJsonSerializer))]namespaceThreeSimpleWaysToLog;publicclassFunction{[Logging(LogEvent=true,LoggerOutputCase=LoggerOutputCase.CamelCase)]publicvoidFunctionHandler(stringinput,ILambdaContextcontext){Personperson=newPerson{Name="Alan Adams",Age=11};Logger.LogInformation<Person>(person,"{Name} and is {Age} years old",newobject[]{person.Name,person.Age});}}publicclassPerson{publicstringName{get;set;}publicintAge{get;set;}}
Possible Solution
The Person should be have be represented in the JSON under a Person property.
"person": {
"name": "Alan Adams",
"age": 11
}
### Steps to Reproduce
Deploy the code above and invoke
### AWS Lambda Powertools for .NET version
latest
### AWS Lambda function runtime
dotnet6
### Debugging logs
_No response_
The text was updated successfully, but these errors were encountered:
bjhogan
added
bug
Unexpected, reproducible and unintended software behaviour
triage
Pending triage from maintainers
labels
Apr 3, 2023
Expected Behaviour
Logger name should not be lost when object logged has a property called "name".
This is lost -
"name": "AWS.Lambda.Powertools.Logging.Logger",
and replaced with"name": "Alan Adams",
.If the object being logged has a
TimeStamp
property, the Lambda timestamp will also be lost.This problem relates to another bug.
Current Behaviour
The logger name is lost
Code snippet
Possible Solution
The
Person
should be have be represented in the JSON under aPerson
property.The text was updated successfully, but these errors were encountered: