swift-aws-lambda-runtime icon indicating copy to clipboard operation
swift-aws-lambda-runtime copied to clipboard

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

Open biajoeknee opened this issue 1 year ago • 1 comments

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

biajoeknee avatar Jan 11 '24 21:01 biajoeknee

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

MahdiBM avatar Jan 12 '24 12:01 MahdiBM