Just arrived! First question here. I am trying to ...
# ask-community
a
Just arrived! First question here. I am trying to figure out Prefect logging using the documentation here: https://docs.prefect.io/core/concepts/logging.html#logging-from-tasks But when I add this to one of my tasks and run it I see no log file:
Copy code
logger = prefect.context.get("logger")
<http://logger.info|logger.info>("An info message.")
I tried running it from the interface on Prefect Cloud but that doesn't do anything either. What am I missing here?
k
Hi @Alexander Kloumann, welcome! This won’t come out as a log file. It will appear in the Prefect logs in the UI.
a
Thanks! And where do I find that? I'm looking at the flow in Prefect Cloud and don't see it there.
k
In the Flow Run page -> Logs
a
Thanks @Kevin Kho!
k
1
a
@Kevin Kho I was wondering also if it's possible to generate log files locally
k
Something like this
👍 1
s
Piggybacking on this. If I want to write the logs from all the tasks in a flow to one file does this mean I need to add the filehandler to the logger at the top of every task? If so is there a way of storing the name of that file in a flow-wide variable, e.g. if I want the logfile to be named after the time that the flow started, how does each task know the name of the file?
k
Every task OR if you use script-based storage , it will be created at the start of the Flow because the script is ran