https://prefect.io logo
Title
f

Felix Tremblay

09/08/2022, 9:33 PM
Hi all, I was having issues with the logging in Prefect. I wanted to share my solution in case it helps someone else. Issue 1 - Prefect logger does not work outside of Prefect context Issue 2 - Prefect logger needs to have get_run_logger() in every functions Solution (proof-of-concept): See https://discourse.prefect.io/t/hybrid-logger-a-logger-that-works-both-inside-and-outsite-of-a-prefect-context/1559 @Taylor Curran
:wood: 3
:blob-attention-gif: 4
โœ… 2
:marvin: 4
๐Ÿ˜›anda-dancing: 4
t

Taylor Curran

09/08/2022, 9:39 PM
Hi Felix! Thank you for sharing ๐Ÿ™‚ Is the solution you outline in discourse working for you? Any blockers there?
f

Felix Tremblay

09/09/2022, 1:21 AM
Hi Taylor! Using "os.environ ... ", is a hacky way to make the logger visible to Prefect Cloud. I think that it won't be effective unless you already ran the file before. I don't know if there is a better way to change Prefect's settings from within python...
a

Anna Geller

09/09/2022, 1:35 AM
Thanks Felix for writing this up, I'll ask some engineers who know this better whether they could answer your questions
โค๏ธ 1