Skip to content

Commit

Permalink
add logger to celery module
Browse files Browse the repository at this point in the history
  • Loading branch information
oleggator committed Oct 4, 2019
1 parent de7e90a commit d24c91c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions jarbas/celery.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import logging
import os
from celery import Celery
from celery.schedules import crontab

from django.conf import settings

logger = logging.getLogger('celery')

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'jarbas.settings')

app = Celery('jarbas')
Expand All @@ -17,9 +20,9 @@ def setup_periodic_tasks(sender, **kwargs):

@app.task(ignore_result=True)
def searchvector():
print('Running searchvector...')
logger.info('Running searchvector...')
management.call_command('searchvector')
print('Searchvector is done')
logger.info('Searchvector is done')

if settings.SCHEDULE_SEARCHVECTOR:
sender.add_periodic_task(
Expand Down

0 comments on commit d24c91c

Please sign in to comment.