Channels 4.0 channel worker logging #1953
Replies: 1 comment 1 reply
-
I've since set up a separate management command and spun up these clients in a totally different worker thread from the channels and their consumers. This seems to have resolved the issue. My $0.02: there is very limited documentation on the right way to create or attach new protocol servers or on how to proxy such a server through a small client, such as I've done above. One of the purported benefits of channels, straight from the docs:
But as far as solid examples and guidance on best practices for going beyond HTTP, Websockets and the natively supported stuff, not much exists. Are there community projects, perhaps, that could be drawn on to augment the docs and enable such workflows (namely, a workflow that bridges protocols like MQTT, OPC-UA, etc. with channels)? |
Beta Was this translation helpful? Give feedback.
-
Objective
I am building consumers that will help me interact with an OPC-UA server. I have constructed a consumer class that spins up a client that will subscribe to OPC-UA data changes and pass the resulting events/messages into a channel ( opcua-listen). Just doing proof of concept stuff at this point, but the eventual goal will be to capture device states in the application’s back end.
Issue
The problem is none of my consumer log messages appear when I run the associated worker, and it is impossible for me to tell if my consumer’s methods are receiving these messages. In the same project, I've confirmed that I can get logs from a WebsocketConsumer to appear, so it appears that the issue relates only to the AsyncConsumer that I’ve established.
Setup
My consumer class looks like this:
The substance of the client class looks more or less like below:
My Django logging setup is:
In stdout from
runserver
andrunworker
, I find no trace of log statements for this consumer or the associated client that it spins up. I do see logs for other consumer types (from HTTP and Websocket protocol stuff), but not from named channels.Your OS and runtime environment, and browser if applicable
python:3.9.0-buster base docker image
A pip freeze output showing your package versions
freeze.txt
What you expected to happen vs. what actually happened
Expecting to see debug log statements per other consumers, Django views, etc. Seems very similar to Logging not working #1625 Logging not working #1648.
How you're running Channels (runserver? daphne/runworker? Nginx/Apache in front?)
manage.py runserver and manage.py runworker
Beta Was this translation helpful? Give feedback.
All reactions