Description
Description
In .Net 5, ILambdaLogger.LogLine("hello world") would be logged to CloudWatch Logs exactly as
hello world
After changing my Lambda project's TargetFramework from net5.0 to net6.0, the same call to ILambdaLogger.LogLine is logged to CloudWatch Logs as "{timestamp}\t{requestId}\t{level}\t{message}"
2021-11-14T21:32:01.022Z 8247f3ba-2335-4b12-bf19-e379605ba146 info hello world
In my real Lambda project, my message is a json string which I subsequently deserialise. With the new behaviour in .Net 6, the message is no longer valid json because of the extra tab-delimited fields in each message.
Reproduction Steps
In a custom runtime Lambda, set the function handler to this
public static DateTime FunctionHandler(ILambdaContext context)
{
context.Logger.LogLine("hello world");
return DateTime.UtcNow;
}
Deploy this Lambda using TargetFramework net5.0 then invoke the function and check the CloudWatch Logs output. The log event's message will be "hello world". Deploy the Lambda again using TargetFramework net6.0 then invoke the function again and check the CloudWatch Logs output again. The log event's message will have tab-delimited fields followed by "hello world".
Environment
- Build Version: Amazon.Lambda.Core 2.1.0
- OS Info: AmazonLinux2
- Build Environment: docker
- Targeted .NET Platform: net5.0 and net6.0
Resolution
I would like the .Net 6 behaviour to return to the previous .Net 5 behaviour where the log event's message is exactly as I passed to ILambdaLogger.LogLine(...)
This is a 🐛 bug-report