Skip to content
This repository has been archived by the owner on Jan 19, 2022. It is now read-only.

Add setting for celery logging #179

Closed
wants to merge 2 commits into from
Closed

Conversation

Callek
Copy link
Contributor

@Callek Callek commented Mar 3, 2015

I had a desire to use debug logging for celery for relengapi, but I wanted it without the added global debugging (using celery worker --loglevel debug adds loads of other output) (my current solution has been print which is sub-par)

Basically I just wanted relengapi.* to log in debug mode. I got the general idea for this approach from http://www.toforge.com/2011/06/celery-centralized-logging/

The structure of it stemmed mostly from needed to have the signal setup before celery fully instantiates (calls its signals), but after the relengapi app is setup, and in a spot that the signal can actually access the app.

This code would need docs and test(s) if it was to be merged in, but I wanted a 👍 for the general idea first. @djmitche or @mrrrgn . What do you think?

from flask import current_app
from werkzeug.local import LocalProxy

_defined_tasks = {}
_relengapi_log_lvl = None # Used for celery log level
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like this because it's independent of any particular app.

Does current_app work from the after_setup_logger signal? Alternately, can you read RELENGAPI_CELERY_LOG_LEVEL from celery.conf during that signal hook?

@Callek
Copy link
Contributor Author

Callek commented Mar 4, 2015

@djmitche is this better/acceptable? (if so I can adjust docs and see about testing, in near future.)

@djmitche
Copy link
Contributor

djmitche commented Mar 4, 2015

Yes, very nice!

@djmitche
Copy link
Contributor

@Callek -- ping re testing/docs?

@djmitche djmitche modified the milestone: v1.2.0 Mar 16, 2015
@djmitche
Copy link
Contributor

@Callek ping? I'd like to get 2.0.0 out soon, but this still needs testing and docs..

@djmitche
Copy link
Contributor

Also, this would be really handy for me in debugging tooltool :)

@Callek
Copy link
Contributor Author

Callek commented Mar 23, 2015

@djmitche fwiw I don't expect to get to the docs/testing part of this, this week. If you want to pick this up and run with it by all means. Otherwise I expect to round it out early in April

@djmitche djmitche self-assigned this Mar 23, 2015
@djmitche djmitche mentioned this pull request Apr 1, 2015
@djmitche djmitche closed this Apr 1, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants