By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,427 Members | 1,354 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,427 IT Pros & Developers. It's quick & easy.

Python Debug logging

P: n/a
Is there a simple way to log to a debug console in
Python?

In .NET, you can Debug.Write(str), which does nothing
if there is no debug console open, but, if there is,
debugs the message. Is there something similar?

Alternatively, is there a very simple log4j type
setup? I emphasize very simple, since, for me, having
to go through all the log4j xml configuration defeats
the purpose of coding quickly in python anyway... I'm
looking for something along the lines of log4p(DEBUG,
str) and then just a one line config somewhere
log4p.DEBUG=stderr or =/dev/null

Anything like this?

Thanks
PS Please cc me on all responses, muchos gracias

__________________________________
Do you Yahoo!?
Make Yahoo! your home page
http://www.yahoo.com/r/hs
Jul 18 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
gf gf wrote:
Is there a simple way to log to a debug console in
Python?

In .NET, you can Debug.Write(str), which does nothing
if there is no debug console open, but, if there is,
debugs the message. Is there something similar?

Alternatively, is there a very simple log4j type
setup? I emphasize very simple, since, for me, having
to go through all the log4j xml configuration defeats
the purpose of coding quickly in python anyway... I'm
looking for something along the lines of log4p(DEBUG,
str) and then just a one line config somewhere
log4p.DEBUG=stderr or =/dev/null

Anything like this?


Try googling for "python logging". YOu can try search this newsgroup as
well. It's the least you can do before posting.

Huy
Jul 18 '05 #2

P: n/a
gf gf wrote:
Is there a simple way to log to a debug console in
Python?

In .NET, you can Debug.Write(str), which does nothing
if there is no debug console open, but, if there is,
debugs the message. Is there something similar?

Alternatively, is there a very simple log4j type
setup? I emphasize very simple, since, for me, having
to go through all the log4j xml configuration defeats
the purpose of coding quickly in python anyway... I'm
looking for something along the lines of log4p(DEBUG,
str) and then just a one line config somewhere
log4p.DEBUG=stderr or =/dev/null

Anything like this?


Try googling for "python logging". YOu can try search this newsgroup as
well. It's the least you can do before posting.

Huy
Jul 18 '05 #3

P: n/a
gf gf wrote:
Is there a simple way to log to a debug console in
Python?


Don't know exactly what you want, but you should check out the logging
module:

http://docs.python.org/lib/minimal-example.html

STeVe
Jul 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.