On Thu, 8 Mar 2001 13:42:59 +1300 (NZDT) John Morton <jwm@plain.co.nz> wrote:
2. ZServer and ZLogger both use a copy each of Sam Rushing's syslog module, but while ZLogger calls it properly, ZServer simply isn't. It doesn't appear to pass it a port at all.
3. Further up the line, the code that creates the logging object seems to pass ZSYSLOG straight through as a server address.
Actually this analysis is completely wrong, as it turns out. This is what's really going on: For the ZSYSLOG case, the documentation claims that the environment variable can be set to anything, and it will log to /dev/log: http://www.zope.org/Documentation/Misc/LOGGING.txt This is true in the case of ZLogger, but ZServer passes the value to syslog_client which treats string addresses as filesystem sockets to write to - so ZSYSLOG better be set to /dev/log or ZServer will bomb on startup. Patching lib/python/ZLogger/syslogLogger.py like this: --- syslogLogger-old.py Thu Mar 8 14:22:32 2001 +++ syslogLogger.py Thu Mar 8 14:22:56 2001 @@ -99,7 +99,7 @@ self.client = syslog_client((addr, int(port))) self.on = 1 elif os.environ.has_key('ZSYSLOG'): - self.client = syslog_client() + self.client = syslog_client(os.environ['ZSYSLOG']) self.on = 1 else: self.on = 0 ...will mean that ZLogger uses the same behaviour as ZServer For the ZSYSLOG_SERVER case, ZLogger is doing the right thing by turning the string address into an address, port tuple. This is also performed in z2.py, but the code there doesn't make sure that the port number is an integer, causing an eventual type error. --- z2-old.py Thu Mar 8 14:25:08 2001 +++ z2.py Thu Mar 8 14:25:56 2001 @@ -594,7 +594,8 @@ elif os.environ.has_key('ZSYSLOG'): lg = logger.syslog_logger(os.environ['ZSYSLOG']) elif os.environ.has_key('ZSYSLOG_SERVER'): - lg = logger.syslog_logger(string.split(os.environ['ZSYSLOG_SERVER'], ':')) + (address, port) = string.split(os.environ['ZSYSLOG_SERVER'], ':') + lg = logger.syslog_logger((address, int(port))) else: lg = logger.file_logger(LOG_PATH) (I've submitted it all to the collector, BTW). John