Fred Drake wrote:
The configuration of the logging is handled using a ZConfig component that's actually bundled with ZConfig itself on the Zope 2 head; it's in the package ZConfig.components.logger. This allows any project using ZConfig to use the same basic logging support; we actually have several projects using ZConfig outside the application server.
Cool. Okay, quick question for you... I'm trying to set up some (normal python) logging so that run of the mill messages are send to a logfile while critical errors are sent via email to me. I got to: import logging logger = logging.getLogger('X2Y') hdlr = logging.FileHandler(logfile) formatter = logging.Formatter('%(asctime)s %(process)d %(levelname)s %(message)s') hdlr.setFormatter(formatter) logger.addHandler(hdlr) if len(sys.argv)==2 and sys.argv[1]=='debug': logger.setLevel(logging.DEBUG) else: logger.setLevel(logging.INFO) hdlr = logging.SMTPHandler(*etc*) formatter = logging.Formatter('%(asctime)s %(process)d\n\n%(message)s\n\n%(pathname)s line %(lineno)d.') hdlr.setFormatter(formatter) logger.addHandler(hdlr) ...but then couldn't figure out how to say that the SMTPHandler should only deal with messages that are critical. Any ideas? Bringing this back on topic, I'd also be very interested in doing the same thing for Zope instances... cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk