-
Notifications
You must be signed in to change notification settings - Fork 61
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
Jobtastic Task uses the root logger #44
Comments
For example, I have this in my logs:
Which I know is telling me that a task has failed and comes from
|
Looking at the current Celery docs (http://celery.readthedocs.org/en/latest/userguide/tasks.html#logging) and bearing in mind the requirement for Celery 2.x compatibility, we could use: try:
from celery.utils.log import get_task_logger
logger = get_task_logger(__name__)
except ImportError:
# get_task_logger is new in Celery 3.X
logger = logging.getLogger(__name__) I think that would also allow use to remove all the logging setup in the Tasks, such as: if get_task_logger:
self.logger = get_task_logger(self.__class__.__name__)
else:
# Celery 2.X fallback
self.logger = self.get_logger(**kwargs) |
No good reason at all. Your Thanks for filing an issue and researching a solution! |
This seems to have been completed partially, but there are still a bunch of calls to |
I thought that the best practice was to get the logger at the top of the module:
Currently,
JobtasticTask
just uses the root logger in a few places (logging.info('Found existing cached and completed task: %s', task_id)
) which makes it hard to create special logging configurations for Tasks.Is there a reason to use the root logger, or can I create a PR to change them?
The text was updated successfully, but these errors were encountered: