[issue6444] multiline exception logging via syslog handler

Max Arnold report at bugs.python.org
Wed Jul 15 18:19:33 CEST 2009


Max Arnold <lwarxx at gmail.com> added the comment:

Which syslog daemon you use?  I've encountered this on syslog-ng. There
is stripped down syslog-ng.conf (messages with facility LOCAL0 are
routed to /var/log/local.log and all others to /var/log/default.log):

#------------------------------------------------------
options {
        chain_hostnames(off);
        use_dns (no);
        use_fqdn (no);
        sync(0);
        stats(43200);
};

source src {
        unix-stream("/dev/log" max-connections(256));
        internal();
        file("/proc/kmsg");
};

template t_filetmpl {
        template("$YEAR-$MONTH-$DAY $HOUR:$MIN:$SEC $HOST $MSG\n");
};

# Create destinations
destination default { file("/var/log/default.log" template(t_filetmpl) ); };
destination local { file("/var/log/local.log" template(t_filetmpl) ); };

# Create filters
filter local { facility(local0) or program("^root.*"); };

# Connect source and destinations
log { source(src); filter(local); destination(local); flags(final); };
log { source(src); destination(default); };
#------------------------------------------------------


And this is result:

# first line landed in /var/log/local.log
Jul 15 23:52:02 localhost root: ERROR <module>/14 division by zero

# remaining ones in /var/log/default.log
Jul 15 23:52:02 localhost Traceback (most recent call last):
Jul 15 23:52:02 localhost File "./test.py", line 12, in <module>
Jul 15 23:52:02 localhost a = 1/0
Jul 15 23:52:02 localhost ZeroDivisionError: integer division or modulo
by zero

Results like yours (which are not very readable but still appropriate
for me) I get only when logging performed via udp socket.

----------
status: pending -> open

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6444>
_______________________________________


More information about the Python-bugs-list mailing list