Jake 1986
Jake 1986

Reputation: 602

Django - where can I find the output of print() statements in production?

Django - where can I find the output of print() statements in production? I'm using a Digital Ocean droplet, Ubuntu 16.04.

I don't see print() output in access.log or error.log files. Is this something I need to set up manually?

Upvotes: 1

Views: 3068

Answers (1)

Caio Kretzer
Caio Kretzer

Reputation: 169

You can make it using a Django funcionality called Logging.

You can look at: https://docs.djangoproject.com/en/dev/topics/logging/

To setup:

import logging
log = logging.getLogger(__name__)

To print:

log.debug('Message that you want')

The log will go where your django logs are pointed.

Upvotes: 1

Related Questions