[mod_python] Introducing AnalyzeThat!

Kamil Niechajewicz kamil at nvstudio.pl
Wed Aug 18 14:53:42 EDT 2004


On Tue, 17 Aug 2004 18:29:17 +0200
Amir Salihefendic <amix at amix.dk> wrote:

> I was pretty tired of the way that you test out stuff in mod_python. 
> I.e. you use req.write(variable), req.write(dir(object)) etc.

Isn't it better to write some logging class with log levels similar
to those of syslog for example? You write your debug output to that
file and read it immediately in the other console window..
For example:

	logger = Log("/tmp/debug.log")
	logger.logWARN("some special condition")
	logger.logDEBUG("result: " + `some_variable`)
	
and so on. 

Then you read the file using 'tail -f' for example, which immediately
shows you new lines from /tmp/debug.log file. I've found this method
extremely comfortable to use.

You can write some disable/enable mechanism, so that you can later
do logger.setDebug(FALSE) to disable logging, which can affect
performance on production servers where there are a lot of processed
requests..

I think this is one of the best methods to debug web applications,
because it does not affect web page (like debugging using req.write()
which prints those values on the page)

Best regards,

/Kamil


More information about the Mod_python mailing list