https://prefect.io logo
j

John Song

09/29/2020, 11:49 PM
A dumb question, how can I redirect or config prefect logging to a local file? I read to doc but didn't find any example to do it
c

Chris White

09/29/2020, 11:51 PM
Hi @John Song - probably the easiest way is via a
FileHandler
(https://docs.python.org/3/library/logging.handlers.html#filehandler) You can access the global prefect logger via:
Copy code
from prefect.utilities.logging import get_logger

root_logger = get_logger()
and configure it / add handlers from there!
j

John Song

09/30/2020, 12:37 AM
Great, thanks Chris!
👍 1
I just tried, it seems only log message from FlowRunner, not TaskRunner
c

Chris White

09/30/2020, 12:58 AM
are you running on dask?
j

John Song

09/30/2020, 1:00 AM
yes, it's working now. I need to put it in the global space, not in the method
c

Chris White

09/30/2020, 1:00 AM
ah ok great!
j

John Song

09/30/2020, 1:01 AM
thanks!
👍 1