将Python日志记录消息路由到AWS Glue中的Cloudwatch [英] Routing Python logging messages to Cloudwatch in AWS Glue
问题描述
我已经编写了一个Python(pyspark)库,该库正在我的AWS Glue脚本中使用.Python库使用 import logger的常用方法记录日志;日志= logging.getLogger(__ name__);log.info(消息)
.
I have written a Python (pyspark) library which I am using in my AWS Glue scripts. The Python library logs using the usual method of import logger; log = logging.getLogger(__name__); log.info(message)
.
我希望在我的胶水作业运行时这些日志显示在Cloudwatch中.如何将这些Python日志路由到Cloudwatch?
I would like these logs to appear in Cloudwatch when my glue job runs. How can I route these Python logs to Cloudwatch?
推荐答案
您需要在将日志发送到Cloudwatch的python记录器上设置Cloudwatch处理程序.
You need to set up a Cloudwatch handler on the python logger that sends logs to Cloudwatch.
一种方法是使用 这篇关于将Python日志记录消息路由到AWS Glue中的Cloudwatch的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!>望塔
,您可以在