Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.

#1 Nov. 26, 2005 03:20:36

Adrian H.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

mod_python log


On 11/25/05, stava <> wrote:
> Has anyone been able to capture the output from "DEBUG = True" when
> using mod_python? I would have expected it to show up in the apache
> log, but it didn't.

The short answer is that Django handles the errors, so errors don't
show up in your error_log. If you add yourself to the ADMINS setting
and set the EMAIL_HOST setting, Django will e-mail you each time
there's an error if DEBUG = False. (Yes, this behavior is currently
undocumented.)

I've added an "Error handling" section to the Django/mod_python docs.
Thanks for the question.http://www.djangoproject.com/documentation/modpython/#error-handlingAdrian

--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org

Offline

#2 Nov. 27, 2005 08:27:11

s.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

mod_python log


Yup, that's great, thank you.

But what I'm really looking for is DEBUG capabilities when using
mod_python, i.e. I would like to be able to see my print statements
embedded in "if DEBUG:" and especially the db queries timings (which
are available somehow?). I do most of the debugging using the
django-admin runserver, but on occasion, it might be useful to do some
of it on a live site, if nothing else: when doing final verification
and testing before deployment. So, when using mod_python and turning on
DEBUG, where do the print statements end up?

R
/LarS

Offline

#3 Nov. 27, 2005 13:54:05

Adrian H.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

mod_python log


On 11/27/05, stava <> wrote:
> But what I'm really looking for is DEBUG capabilities when using
> mod_python, i.e. I would like to be able to see my print statements
> embedded in "if DEBUG:" and especially the db queries timings (which
> are available somehow?). I do most of the debugging using the
> django-admin runserver, but on occasion, it might be useful to do some
> of it on a live site, if nothing else: when doing final verification
> and testing before deployment. So, when using mod_python and turning on
> DEBUG, where do the print statements end up?

When you use mod_python, print statements don't end up anywhere. The
best way to print out debugging statements is to either "assert False,
'hello world'" or add the debug output to the outputted page.

I've updated the mod_python docs page to reflect this.

Adrian

--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org

Offline

#4 Nov. 27, 2005 17:16:09

Christopher L.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

mod_python log


Am 27.11.2005 um 14:53 schrieb Adrian Holovaty:On 11/27/05, stava <> wrote:But what I'm really looking for is DEBUG capabilities when using
mod_python, i.e. I would like to be able to see my print statements
embedded in "if DEBUG:" and especially the db queries timings (which
are available somehow?). I do most of the debugging using thedjango-admin runserver, but on occasion, it might be useful to dosomeof it on a live site, if nothing else: when doing final verificationand testing before deployment. So, when using mod_python andturning onDEBUG, where do the print statements end up?When you use mod_python, print statements don't end up anywhere. The
best way to print out debugging statements is to either "assert False,
'hello world'" or add the debug output to the outputted page.

I've updated the mod_python docs page to reflect this.Actually, AFAIK, you can do:

print >> sys.stderr, "Hello"

to get messages into the Apache error log.
I.e. print to stderr instead of stdout.

Cheers,
Chris
--
Christopher Lenz
cmlenz at gmx.dehttp://www.cmlenz.net/

Offline

#5 Nov. 27, 2005 21:03:32

s.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

mod_python log


OK, I see, thanks Adrian!
/L

Offline

#6 Nov. 27, 2005 21:06:25

s.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

mod_python log


Well, thanks for the input, couldn't get it to work though. I put a few
"print >> sys.stderr..." in there, shows up as per usual when running
the django server, but they don't show up anywhere in the apache logs.
Maybe there's some httpd.conf dependency, I'm running SuSE 9.3 with
minimal tweaks.
/LarS

Offline

#7 Nov. 28, 2005 08:38:53

Christopher L.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

mod_python log


Am 27.11.2005 um 22:06 schrieb stava:Well, thanks for the input, couldn't get it to work though. I put afew"print >> sys.stderr..." in there, shows up as per usual when running
the django server, but they don't show up anywhere in the apache logs.
Maybe there's some httpd.conf dependency, I'm running SuSE 9.3 with
minimal tweaks.You need to explicitly flush the output as it's being buffered:

print >> sys.stderr, "Hey"
sys.stderr.flush()

Cheers,
Chris

--
Christopher Lenz
cmlenz at gmx.dehttp://www.cmlenz.net/

Offline

#8 Nov. 28, 2005 09:55:59

s.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

mod_python log


Yup, that took care of it, thanks!
/LarS

Offline

Board footer

Moderator control

Enjoy the 20th of January
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support