When attaching a log handler (e.g., slack) to pref...
# prefect-community
m
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
Could you show me a code sample?
m
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) 🙂