A dumb question, how can I redirect or config pref...
# ask-community
j
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
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
Great, thanks Chris!
👍 1
I just tried, it seems only log message from FlowRunner, not TaskRunner
c
are you running on dask?
j
yes, it's working now. I need to put it in the global space, not in the method
c
ah ok great!
j
thanks!
👍 1