Heroku worker does not register or prints

I have a Heroku working speaker that doesn't print or write anything to Heroku logs.

I have set the worker to my procfile so that all logging.info () commands work:

worker: celery -A tasks worker -B --loglevel=info

      

Here is the tasks.py file:

from celery import Celery
from celery.decorators import periodic_task
from celery.utils.log import get_task_logger
logger = get_task_logger(__name__)
import json
import settings, logging
import datetime
from mongoengine import DoesNotExist

app = Celery('tasks', 
    broker=settings.get('rabbitmq_bigwig_url'),
    backend='amqp')

@periodic_task(run_every=datetime.timedelta(minutes=1))
def test():
    print 'Not printing!'
    logging.info('Also not printing!')

      

How can I get print / write messages to write to Heroku logs? I've tried all Heroku log commands (hero logs, hero logs --ps, etc.)

+3


source to share


1 answer


In the example above, you initialize logger = get_task_logger(__name__)

, but then when you want to write something, you use logging.info(..)

. On the last line, replace logging.

with logger.

.



0


source







All Articles