WebFaction
Community site: login faq

I have some debugging statements that I need to print out from my Django out, but I cannot find which file to look for them. They do not appear in the access logs or the error logs. Where can I find the file which they appear?

asked 02 May '12, 22:16

kelp
1234
accept rate: 0%


Instead of using print statements you can use python's logging module. http://docs.python.org/howto/logging.html

permanent link

answered 04 May '12, 23:29

markusbarth
1127
accept rate: 0%

Print goes to sys.stdout, which is thrown away by mod_wsgi. You have to print to sys.stderr,

import sys
print >> sys.stderr, "string or object goes here"

This will send the output to the error log defined in httpd.conf. There are solutions that send sys.stdout to sys.stderr but they have unexpected side effects, the safest way is the above method.

permanent link

answered 02 May '12, 22:25

johns
5.4k312
accept rate: 23%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×909
×337

question asked: 02 May '12, 22:16

question was seen: 19,032 times

last updated: 04 May '12, 23:29

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM