Emit custom logs
To emit custom logs, useget_run_logger from within a flow or task.
get_run_logger support the standard Python logging methods. Any logs emitted by the logger will be associated with the flow run or task run they are emitted from and sent to the Prefect backend. Logs sent to the Prefect backend are visible in the Prefect UI.
Log with print statements
To sendprint statements to the Prefect backend as logs, set the log_prints kwarg to True on the flow or task.
log_prints kwarg is inherited by default by nested flow runs and tasks. To opt out of logging print statements for a specific task or flow, set log_prints=False on the child flow or task.
log_prints setting for all Prefect flow and task runs through the
PREFECT_LOGGING_LOG_PRINTS setting: