https://prefect.io logo
#prefect-community
Title
# prefect-community
d

Darshan

03/18/2022, 9:06 PM
Hello, for prefect 2.0 - if I want to add flow run id in all the log statements, do I have to override format of all the loggers defined in default logging config or is there a way to apply this change by overriding only one parent logger?
k

Kevin Kho

03/18/2022, 9:13 PM
I think the config is the preferred way, but I think you might be able to override the logger you get with
get_run_logger()
if you override it inside the flow
Have you seen the formatter section here ?
d

Darshan

03/18/2022, 9:46 PM
Yes I did try the formatter, but what I am struggling with is if I change a formatter PREFECT_LOGGING_FORMATTERS_FLOW_RUNS_FORMAT, it only will apply to log statements generated by flow run and not task run. If I want to apply a format change across all the loggers without having to set formatter for each logger separately, how do I do it ?
k

Kevin Kho

03/18/2022, 11:46 PM
Yeah looking at the file, I think you’d need to edit them separately. I may be wrong also, I’ll find out for sure on Monday
d

Darshan

03/19/2022, 12:15 AM
Cool thank !
4 Views