Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23160

How can Celery configure submodules' loggers?

$
0
0

My understanding is that @after_setup_logger.connect is supposed to allow you to attach custom handlers. However, this does not work for me.

@after_setup_logger.connectdef setup_loggers(logger: logging.Logger, *args, **kwargs):    h = LogCollector()    logger.addHandler(h)  # or even logger.getLogger().addHandler(h)@app.task()def add(x: int, y: int):    result = x + y    logger.info(f"Add: {x} + {y} = {result}")    return result

Inside the add function, logger does not have handlers. What am I doing wrong?


Viewing all articles
Browse latest Browse all 23160

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>