How do I write messages to the output log on AWS Glue?

后端 未结 5 752
小鲜肉
小鲜肉 2021-02-05 06:00

AWS Glue jobs log output and errors to two different CloudWatch logs, /aws-glue/jobs/error and /aws-glue/jobs/output by default. When I include p

5条回答
  •  余生分开走
    2021-02-05 06:49

    I faced the same problem. I resolved it by added logging.getLogger().addHandler(logging.StreamHandler(sys.stdout))

    Before there was no prints at all, even ERROR level

    The idea was taken from here https://medium.com/tieto-developers/how-to-do-application-logging-in-aws-745114ac6eb7

    Another option would be to log to stdout and glue AWS logging to stdout (using stdout is actually one of the best practices in cloud logging).

    Update: it works only for setLevel("WARNING") and when prints ERROR or WARING. I didn't find how to manage it for the INFO level :(

提交回复
热议问题