473,387 Members | 1,745 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Python Debug logging

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
3 1772
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Birgit Rahm | last post by:
Hello newsgroup, I work with omniORB for python and I what to log the calls, does anyone in this group know how I can do this? I use the command to initialize the ORB ORB =...
8
by: Joakim Persson | last post by:
Hello all. I am involved in a project where we have a desire to improve our software testing tools, and I'm in charge of looking for solutions regarding the logging of our software (originating...
27
by: Josh | last post by:
We have a program written in VB6 (over 100,000 lines of code and 230 UI screens) that we want to get out of VB and into a better language. The program is over 10 years old and has already been...
6
by: Sambo | last post by:
Some time ago I bought a newer computer with W2000 already on it so I moved my old drive to it as secondary( python was installed on non primary partition ). Not sure if the .msi installers were...
5
by: Ritesh Raj Sarraf | last post by:
import os, sys, logging logger = logging.getLogger("my_app") conerr = logging.StreamHandler(sys.stderr) conerr.setLevel(logging.DEBUG) conerr_formatter = logging.Formatter('%(levelname)s...
4
by: siggi | last post by:
Hi all, newbie question: I'd like to try speech synthesis with PythonWin 2.5. Problem ****** according to several instructions, such as found on...
8
by: Derek Martin | last post by:
I'd like to know if it's possible to code something in Python which would be equivalent to the following C: ---- debug.c ---- #include <stdio.h> bool DEBUG;
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.