Hi,
We've been using TurboGears now for some time, and have been slightly
annoyed by the logging output printed on the screen together with the
output of unittest module.
Now I had a look at where the output is coming from, and I discovered
three sources:
(1) cherrypy
It apparently uses its own logging and configuration. We can get rid of
it by doing something like:
import cherrypy
cherrypy.config.update({'server.logToScreen': False})
(2) TurboGears logging
It's using python logging module. The problem is that we can not change
the configuration of the logging, because in startup.py we see:
if cherrypy.config.get('server.environment') == 'development':
log = logging.getLogger()
...
handler = logging.StreamHandler(sys.stdout)
...
log.addHandler(handler)
So the only option I see there is to do
import cherrypy
cherrypy.config.update({'server.logToScreen': False,
'server.environment': '<something different than development>'})
In cherrypy tests they seem to use 'production'. I'm not sure if that's
a good idea. Maybe 'testing' can be used instead. At this point I don't
see the side effects of changing this property.
(3) print statement
In view.py there is a print statement:
print "setting default site"
Nothing we can do about this but to remove it (or change it to
logging).