Is there a good way to log to Prefect from a jupyt...
# ask-community
j
Is there a good way to log to Prefect from a jupyter notebook running in
ExecuteNotebook
?
j
Hi Josh, are you looking for a way to log directly from cells in the executing notebook? Or just log the shell output of nbconvert (which is used to execute the notebook).
j
the cells of the notebook.
Is there a way to get the cell output into the Prefect logs? Right now, I don’t have any logs so can’t debug failed notebooks easily.
j
I haven't tested, but using the prefect logger might work without any extra configuration:
Copy code
from prefect.utilities.logging import get_logger

logger = get_logger()
<http://logger.info|logger.info>("This may work from within a cell")
🎯 1
It looks like you can configure papermill to output the notebook logs during execution, the
ExecuteNotebook
task could be modified to improve the logs here. I'll open an issue to track that.
@Marvin open "Improve logging in
ExecuteNotebook
task"