Malthe Karbo

    Malthe Karbo

    4 months ago
    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?
    Kevin Kho

    Kevin Kho

    4 months ago
    Could you show me a code sample?
    Malthe Karbo

    Malthe Karbo

    4 months ago
    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
    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) 🙂