Hello! I'm experimenting with serverless workqueu...
# prefect-cloud
c
Hello! I'm experimenting with serverless workqueues. I am using Prefect Cloud, triggering containers stored in AWS ECR. I have created a demo flow, built the encapsulating Docker image, shipped it to ECR, deployed my flow to Prefect and successfully run an instance of the image. So far, so good. The image is a simple python script (obviously) generating a few log message via python's logging library. No special configuration applied - it's logging to stdout. However, in the Prefect Cloud UI , I cannot see the logs generated by the image. What am I failing to configure? EDIT: flows are annotated
@flow(log_prints=True)
1
n
hi @Cormac > generating a few log message via python's logging library
log_prints
literally patches `builtin.print` with
get_run_logger
, so if you're using
logging
and not
print
then
log_prints
is probably not what you're looking for
c
Thanks @Nate. Is there a recommended redirect for logging, or is it better to use
get_run_logger()
?
n
you can use
print
directly if you have
log_prints=True
on a given task/flow (or parent flow, the setting is inherited and you can opt out as described here) then that will be effectively the same as using
get_run_logger
(sent to the API) if you don't prefer using
print
then you might not use
log_prints=True
,
get_run_logger
offers more control bc you can use
info
,
debug
etc like a normal logger
c
@Nate thanks for the super-quick response! I experimented, and
get_run_logger()
is exactly the thing I need. it's all reporting a treat now.
👍 2