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

runworker does not adhere to logging configuration from settings.py #432

Open
Paul424 opened this issue Jan 11, 2019 · 2 comments
Open

runworker does not adhere to logging configuration from settings.py #432

Paul424 opened this issue Jan 11, 2019 · 2 comments

Comments

@Paul424
Copy link

Paul424 commented Jan 11, 2019

routing.py

application = ProtocolTypeRouter({
...
'channel': ChannelNameRouter({
'process-mailbox': ProcessMailboxConsumer,
}),
})

process_mailbox_consumer.py

import logging
from channels.consumer import SyncConsumer
logger = logging.getLogger('clock')

class ProcessMailboxConsumer(SyncConsumer):
def process(self, message):
logging.debug('test')
logging.info('test')
logging.warning('test')
logging.error('test')

run

(venv) ➜ cclks git:(develop) ✗ python manage.py runworker process-mailbox -v3
2019-01-11 09:24:50,671 MainProcess(20985) MainThread(0x7f0a739c0740) django.channels.worker INFO runworker handle Running worker for channels ['process-mailbox'] runworker.py(40)
WARNING:root:test
ERROR:root:test

I expected to see output formatted and levels enabled as in settings.py.
Notice it does seem to work for the runserver command (both through daphne obviously).

Is this maybe only for development? And solved in Daphne standalone?

Setup:

  • Ubuntu / chrome
  • Django==2.1
  • channels==2.1.6
@andrewgodwin
Copy link
Member

The runworker command is definitely unloved and likely does this wrong.

@dreinhold
Copy link

Shouldn't you be using the logger object to do the logging?

logger.debug('test')
verses
logging.debug('test')

@carltongibson carltongibson transferred this issue from django/channels Aug 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants