[Zope3-Users] Logging level for transcript.log

Jim Fulton jim at zope.com
Sat Feb 3 11:15:58 EST 2007


Vinny wrote:
> Hi,
> 
> Where can I find the configuration setting for the 
> logging level used in the transcript.log file?
> 
> I have tried looking in etc/zope.conf, etc/zdaemon.conf
> and came up empty handed.  I can see ERROR levels easily
> enough. 

The transcript log is created by zdaemon and captures
all output from the application being run, in this case,
Zope.  It has nothing to do with the Python logging system
and has no concept of log level.

 > This works and shows up in transcript.log:
 >
 > import logging
 >
 > logging.basicConfig(level=logging.DEBUG,
 >                     format='%(asctime)s %(levelname)-8s %(message)s',
 >                     datefmt='%a, %d %b %Y %H:%M:%S',
 >                     filename='/usr/local/www/Zope3/mv/lib/python/hello/utility/log',
 >                     filemode='a')
 >
 > logging.error('Pack my box with %d dozen %s', 5, 'liquor jugs')
 >
 > But this does not show up in transcript.log:
 >
 > logging.debug('Pack my box with %d dozen %s', 5, 'liquor jugs')
 >
 > Both messages end up in my local log file.  I think I understand
 > that the logging function is using mine and a logger registered
 > with zope.  Where do I find out about the zope logger?

That's a good question.  Logging is controlled through ZConfig and
I'm not aware that our ZConfig setup is documented, except through
comments in sample zope.conf files.  I'm not a big fan of how we
currently do configuration.

I think you want to change the logging level by adding a level
option to the event log:

<eventlog>
   level debug

   <logfile>
     path $LOGDIR/z3.log
     formatter zope.exceptions.log.Formatter
   </logfile>

   <logfile>
     path STDOUT
     formatter zope.exceptions.log.Formatter
   </logfile>
</eventlog>

In this example, I have set the logging level for the
event logger to debug, so you will see debug messages.
The default logging level is info.

Note that in the example above we are sending output to
2 places, z3.log and standard output.  Because the zdaemon
transcript log captures standard output, it is the standard
output logger that affects the transcript log.  IMO, it is
silly to log to two places. I would just log to standard
output.  (The only problem with this is that older versions
os zdaemon don't support log rotation. I have fixed this
in the latest version of zdaemon.)

Jim

-- 
Jim Fulton           mailto:jim at zope.com       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org


More information about the Zope3-users mailing list