[Zope-dev] syslog

Toby Dickenson tdickenson@geminidataloggers.com
Mon, 1 Oct 2001 16:14:47 +0100


> I'll admit that I don't know.  The ZLogger module makes some 
> noise about 
> syslog, but I dont even know if and when that module is used 
> (as opposed 
> to the zLOG module).

It is actually always used unless Zope is started read-only. Its not easy to
follow *how* this happens - and I am still not sure *why* its done this way.

As for the how:

 ZLogger starts out with a from zLog import *,
 it then sets up the list of standard logger
 objects, and defines the log_write function.

 Later, z2.py transplants the log_write function
 from ZLogger into zLOG, where it is used by
 the implementation of zLOG.LOG (the usual 
 logging API)

>  Have you verified this by trying it?

Definitely yes - my syslog filled up with access log information.

A question for all syslog users; is it ever useful to send access logs to
syslog? (I can't think of good reason, but my syslog zen quotient is still
low). Is anyone else even using syslog?


Anyway, for anyone else interested, below a patch so that the configuration
of access-syslog uses different environment variables to event-syslog. 


Index: z2.py
===================================================================
RCS file: /home/cvs/development/external/Zope2/z2.py,v
retrieving revision 1.14
diff -c -2 -r1.14 z2.py
*** z2.py       10 Sep 2001 15:32:28 -0000      1.14
--- z2.py       1 Oct 2001 14:35:43 -0000
***************
*** 635,646 ****
      if READ_ONLY:
          lg = logger.file_logger('-') # log to stdout
!     elif os.environ.has_key('ZSYSLOG'):
!         lg = logger.syslog_logger(os.environ['ZSYSLOG'])
!         if os.environ.has_key("ZSYSLOG_FACILITY"):
!             lg =
logger.syslog_logger(os.environ['ZSYSLOG'],facility=os.environ['ZSYSLOG_FACI
LITY'])
          else:
!             lg = logger.syslog_logger(os.environ['ZSYSLOG'])
!     elif os.environ.has_key('ZSYSLOG_SERVER'):
!         (addr, port) = string.split(os.environ['ZSYSLOG_SERVER'], ':')
          lg = logger.syslog_logger((addr, int(port)))
      else:
--- 635,646 ----
      if READ_ONLY:
          lg = logger.file_logger('-') # log to stdout
!     elif os.environ.has_key('ZSYSLOG_ACCESS'):
!         lg = logger.syslog_logger(os.environ['ZSYSLOG_ACCESS'])
!         if os.environ.has_key("ZSYSLOG_ACCESS_FACILITY"):
!             lg =
logger.syslog_logger(os.environ['ZSYSLOG_ACCESS'],facility=os.environ['ZSYSL
OG_FACILITY'])
          else:
!             lg = logger.syslog_logger(os.environ['ZSYSLOG_ACCESS'])
!     elif os.environ.has_key('ZSYSLOG_ACCESS_SERVER'):
!         (addr, port) = string.split(os.environ['ZSYSLOG_ACCESS_SERVER'],
':')
          lg = logger.syslog_logger((addr, int(port)))
      else: