swift-server / swift-aws-lambda-runtime

Swift implementation of AWS Lambda Runtime
Apache License 2.0
1.12k stars 100 forks source link

print statements do not work despite context.logger.info(stringLiteral:) working #317

Open biajoeknee opened 5 months ago

biajoeknee commented 5 months ago

Expected behavior

I expect print statement to print to the cloud watch console logs.

Actual behavior

Printing only works via context.logger (Lambda.Context)

Steps to reproduce

1) Execute print statement 2) See that print statement isn't in cloud watch logs

If possible, minimal yet complete reproducer code (or URL to code)

No response

What version of this project (swift-aws-lambda-runtime) are you using?

0.5.2

Swift version

5.8 based on the Amazon Linux 2 docker image — I'm assuming that the swift version included there is the version it's built with.

Amazon Linux 2 docker image version

swift:5.8-amazonlinux2

MahdiBM commented 5 months ago

You might be bumping into some buffering problems. Try fflush(stdout) right after your print().