[Python] Calling a Django Management Command from a Celery Task and Redirecting Logs

Discussão em 'Python' iniciado por Stack, Março 25, 2025.

  1. Stack

    Stack Membro Participativo

    I'm trying to call a Management Command with call_command within a Celery task. The management command writes logs in different ways: through print statements, self.stdout.write, or using the logger defined at the script's module level.

    I want to capture all these log messages in the Celery logger to make them visible in Datadog. Is this possible?

    I tried the worker_redirect_stdouts_level option, but it impacts the global Celery logging configuration.

    Continue reading...

Compartilhe esta Página