Closed pparkkin closed 4 years ago
Thanks for reporting in, could you try flushing stdout after your prints? like so:
import System.IO (hFlush, stdout, stderr)
-- your code...
hFlush stdout
hFlush stderr
This needs to be done inside of a do
block in an IO
-returning function (probably your handler)
When I flush stdout and stderr, the output goes into CloudWatch logs. Thanks!
Do you think there is something that can be done in the runtime to make output go into logs automatically without having to explicitly flush the handles?
Yes, I just realized that for some reason the runtime is not flushing them. Probably it got lost after #29 .
Would you be up to adding this? It should be relatively simple by flushing after this line
Definitely. I'll take a look.
Thanks!
Thanks for accepting the fix!
Version 2.0.2 with the fix from #53 has been pushed to Hackage now. Closing.
Feel free to reopen if something weird appears. Thanks again! 🙏
How can I output logs from my handler?
I have been able to create a Lambda using the runtime, and I can return responses that indicate that my handler is being called correctly.
In order to make it easier to develop and debug, I would like to be able to output logs into the CloudWatch logs for the Lambda. If I just do a
putStrLn
the output is not logged into the CloudWatch log group for the Lambda.