On Mon, Apr 22, 2013 at 11:31 PM, Zbigniew Jędrzejewski-Szmek
<[email protected]> wrote:
> Otherwise, we get SYSLOG_IDENTIFIER=python or something
> similar, which is completely useless.

I think we shouldn't be creating one-off arguments for every possible
field someone might want to add, but something more generic -- take a
dict as argument for example.

Ideally it would be possible to attach custom journal fields to the
Python root logger and have them propagate to all loggers from there.
But I tried and couldn't make it work without the code getting really
ugly. Here are some of my thoughts on the topic:
http://lists.freedesktop.org/archives/systemd-devel/2012-October/006937.html
And a reply: 
http://lists.freedesktop.org/archives/systemd-devel/2012-November/007372.html

Note that Python's SysLogHandler has something vaguely similar, but
it's pretty annoying to use. It's not a constructor argument, but an
attribute you have to override and is simply prepended to the syslog
message so you also have to include the separating colon and space
(like in the C syslog API).

import logging, logging.handlers
h=logging.handlers.SysLogHandler(address='/dev/log')
h.ident='somename: '

l= logging.getLogger('froggerlogger')
l.propagate = False
l.addHandler(h)
l.warning('foo')

Regards,
Marti
_______________________________________________
systemd-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to