https://prefect.io logo
#prefect-community
Title
# prefect-community
m

Malthe Karbo

05/20/2022, 7:54 PM
When attaching a log handler (e.g., slack) to prefect logger, then whenever running a flow with dask, it will log multiple times with the handler - at least this is what we see with our implementation - Is there a good example for attaching a custom log handler to prefect orion logging?
k

Kevin Kho

05/20/2022, 7:55 PM
Could you show me a code sample?
m

Malthe Karbo

05/20/2022, 7:58 PM
I don't have a direct example which I can copy paste, but what we did was more or less use the following https://github.com/mathiasose/slacker_log_handler/blob/master/slacker_log_handler/__init__.py, and then made a function to get logger and called inside flows like this
Copy code
def get_logger():
    logger = get_run_logger()
    logger.addHandler(SlackerLogHandler(...))
    return logger
Would make a better example but I am short on time right now (sorry!). I was just wondering if there existed a good example of writing a log handler specifically for orion (I assume that I have done something wrong) 🙂
20 Views