Skip to content

Logging not working #1625

@sorter

Description

@sorter

Hello.

I have an issue where logging statements are not working in subclasses of WebsocketConsumer. Logger works in the entry point to the daphne application and even above the class declaration but not within the consumer.

logger = logging.getLogger(__name__)
logger.info("This log shows up")

class TrackNotifyConsumer(WebsocketConsumer):
    """API Tracking Notifications Consumer"""

    def connect(self):
        logger.info("This log DOES NOT show up")
        async_to_sync(self.channel_layer.group_add)("track", self.channel_name)
        self.accept()
  • Your OS and runtime environment, and browser if applicable
    Ubuntu 18.04.4 LTS

  • A pip freeze output showing your package versions
    freeze.txt

  • What you expected to happen vs. what actually happened
    Expected logging to work normally and for logs to show up wherever I invoke logger.info(...)

  • How you're running Channels (runserver? daphne/runworker? Nginx/Apache in front?)
    Daphne, nginx

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions