Hi all :wave: I'm trying to get prefect to log mes...
# ask-community
m
Hi all 👋 I'm trying to get prefect to log messages from an internal python library we are using. I managed to get the messages displayed in prefect using
PREFECT_LOGGING_EXTRA_LOGGERS
, however this only results in displaying the message, not the formatting. Specifically, I want to display the path or name of the file from where the log is emitted. Is there any way to achieve this without adding the filename to the logger call in our library?
j
I believe you can put the file and line number in the formatter, you don't need to put it in every logging call. https://docs.python.org/3/library/logging.html#logrecord-attributes
m
Thanks for your suggestion! This is what I tried for our internal logger, and it works When Prefect is picking this up, it uses its own format, which does not include the path or line number. Adding these in the format string of the prefect logger throws an error.
j