betabug... Sascha Welter

home english | home deutsch | Site Map | Sascha | Kontakt | Pro | Weblog | Wiki

04 December 2007

Suppress zLOG output in Zope tests

Another of these "note to self" posts
 

In an old product of mine, the ZopeTestCase tests were being run from a shell script, using framework.py. I'm switching that to running them with zopectl test. It's not too hard after I had found out how. But strange enough it would show any zLOG output of level WARNING or higher on the console. Annoying when all you want to see is a happy line of ......... test dots. So here is how to suppress this log output...


Digging through the web to find the solution didn't help much, but today I dived into the source and discovered that all I had to do was to set up a log.ini file to configure the python logger.

I took the log.ini which I found in the Zope source tarball, and changed it to log to a special place where all WARNINGs are kept in good company and get served nice cups of tea once in a while:

[handler_normal]
class=FileHandler
level=NOTSET
formatter=common
args=('/dev/null', 'a')
...

Of course sometimes it might be necessary to actually see WARNING or other error log messages, in which case I will have to rename log.ini. A command line switch would be nice, but the --nowarnings mentioned in the docs doesn't seem to have any effect in this. This is Zope 2.9 by the way.

I didn't bother to understand the fine points of the log.ini format. I guess it's there for those people who need something special or those who have the time to cut the leaves on their bonsai trees every morning.

Posted by betabug at 13:54 | Comments (2) | Trackbacks (0)
ch athens
Life in Athens (Greece) for a foreigner from the other side of the mountains. And with an interest in digital life and the feeling of change in a big city. Multilingual English - German - Greek.
Main blog page
Recent Entries
Best of
Some of the most sought after posts, judging from access logs and search engine queries.

Apple & Macintosh:
Security & Privacy:
Misc technical:
Athens for tourists and visitors:
Life in general:
<< Nach gerichtet | Main | Autumn Leaves >>
Comments
Re: Suppress zLOG output in Zope tests

Usage of zLOG is disappearing and logging module is now the favorite. Any idea how to suppress those excessive warnings?

Posted by: Peter Bengtsson at February 01,2008 12:42
Re: Suppress zLOG output in Zope tests

Peter, zLOG is here to stay. Nowadays it's just a thin wrapper around the logging module. zLOG has been un-deprecated, there are no more deprecation warnings for zLOG and it works as good as ever.

Posted by: betabug at February 01,2008 12:51
Trackbacks
You can trackback to: http://betabug.ch/blogs/ch-athens/735/tbping
There are no trackbacks.
Leave a comment