2👍
Instead of print "message"
, you could use sys.stderr.write("message")
For logging to stderr with a StreamHandler:
import logging
handler = logging.StreamHandler(stream=sys.stderr)
log = logging.getLogger(__name__)
log.setLevel(logging.INFO)
log.addHandler(handler)
log.info("Message")
1👍
wsgilog is simple, and can redirect standard out to a log file automatically for you. Breeze to set up, and I haven’t had any real problems with it.
- [Django]-How to save django drag and drop connected list sortable
- [Django]-Django celery only calls 1 of 2 apply_async task
- [Django]-Django manage.py syncdb not working?
- [Django]-Is there a framework like now.js for Django?
- [Django]-How to use math remainder in django template?
0👍
No WSGI application component which claims to be portable should write to standard output. That is, an application should not use the Python print statement without directing output to some alternate stream. An application should also not write directly to sys.stdout. (ModWSGI Wiki)
So don’t… Instead, I recommend using a log aggregation tool like sentry. It is useful while developing and a must-have in production.
- [Django]-Example Cron with Django
- [Django]-Int vs String for field choices
- [Django]-D3 bar chart returning height of "NaN"
- [Django]-Strange Issue When Minifying CSS via django-pipeline
- [Django]-How to restrict website users from seeing other user profiles?
Source:stackexchange.com