Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting Celery logging via Django into Sentry #922

Closed
Duologic opened this issue Nov 28, 2016 · 3 comments

Comments

@Duologic
Copy link

commented Nov 28, 2016

Repost from getsentry/sentry#4565 on request of @JTCunning.

Recently we updated Celery to 4.0 in our Django project. The logging gave us some headaches and I would like to help fellow hackers so they don't get stuck on this.

The issue is described in the Celery issue tracker but disregarded as they don't have enough resources to work on it: celery/celery#2437

We had to implement 2 things:

Set CELERYD_HIJACK_ROOT_LOGGER to False in our settings.

And connect to the setup_logging signal from Celery:

from celery import signals

@signals.setup_logging.connect
def setup_logging(**kwargs):
    """Setup logging."""     
    pass

It would be nice to see this reflected in the documentation somewhere. As it looks to me this is very Django-specific, I'd propose to putting it here: https://docs.sentry.io/clients/python/integrations/django/

I also got confused from the settings described on the page about Celery in the Sentry docs. The code there doesn't seem to be required for us. Not sure if we can change something about this to make it more clear when you should use that. Only when you are running celery<4.0 maybe? https://docs.sentry.io/clients/python/integrations/celery/

Otherwise, the docs are great, thank you for that!

What do you guys think?

@ashwoods ashwoods self-assigned this Oct 13, 2017

@ashwoods ashwoods added this to the 6.3.0 milestone Oct 13, 2017

@pabdelhay

This comment has been minimized.

Copy link

commented Mar 23, 2018

Hey @Duologic ,
Where did you put this code from setup_logging? In celery.py (do you config celery here?)?
Thanks in advance

@Duologic

This comment has been minimized.

Copy link
Author

commented Mar 23, 2018

Wow, that is from quite some time ago. I'm not sure if it still works that way, but looking at my own description, that looks like the place to put it. As the decorator makes sure the signal is connected, I'd think it doesn't matter, as long as it gets executed when celery is set up.

@Duologic

This comment has been minimized.

Copy link
Author

commented Feb 4, 2019

As this SDK is being phased out for Sentry-Python, no need to keep this issue open.

@Duologic Duologic closed this Feb 4, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.