Skip to content

LAMBDA_NET_SERIALIZER_DEBUG not working JSON log format #1809

@martincostello

Description

@martincostello

Describe the bug

I've been trying to diagnose an issue I'm getting with trying to use JSON polymorphism with .NET 9 and AoT in a Lambda function, and in the process it seems that LAMBDA_NET_SERIALIZER_DEBUG doesn't work when a Lambda function is configured to log as JSON instead of text.

My guess would be that CloudWatch is expecting the Console.WriteLine() calls to be in a certain format, and then when they aren't silently drops them.

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

Output when LAMBDA_NET_SERIALIZER_DEBUG=true appears in CloudWatch logs.

Current Behavior

Output is missing from CloudWatch logs.

Reproduction Steps

Set LAMBDA_NET_SERIALIZER_DEBUG=true for a C# Lambda function that is configured to use JSON logs.

Possible Solution

Detect that JSON logging is configured and output to the console in a manner that does not got broken by the JSON content of the payloads being logged.

Additional Information/Context

No response

AWS .NET SDK and/or Package version used

Amazon.Lambda.RuntimeSupport 1.11.0

Targeted .NET Platform

.NET 9

Operating System and version

Amazon Linux 2023

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions