[Django]-Benefit of using logging over print() to log information to Papertrail in a Django Heroku app

5👍

I find myself asking that question sometimes, and I usually conclude that print is useful for debugging, but logging is more powerful for everything else.

For instance, logging has log levels, which show severity. And also, logging allows to write logs and output, errors, etc to files.

Any application in production should have a comprehensive logging system in place for these reasons and more.

Take a read through this and it should become clearer:

https://docs.djangoproject.com/en/1.10/topics/logging/

If you aren’t convinced by this answer and the article you cited, I’d recommend doing more research. Otherwise, continue to use print and maybe you’ll convince yourself eventually.

Leave a comment