Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #39873

protect logger from shutdown syslogd

Path csiph.com!usenet.pasdenom.info!news.albasani.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From Mathias Kőrber <mathias@koerber.org>
Newsgroups comp.lang.python
Subject protect logger from shutdown syslogd
Date Mon, 25 Feb 2013 13:34:03 +0800
Lines 58
Message-ID <ap0bedFpdimU1@mid.individual.net> (permalink)
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 7bit
X-Trace individual.net ALALf+jzYYAB+UuuB+0lLgEsm0TztG/LyiWMn5Pg5IUBfhthfJZjlUMvfaR3h++l0=
Cancel-Lock sha1:Yn1gwVwLQoBjosySWTLlrcJ2mMU=
User-Agent Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130216 Thunderbird/17.0.3
X-Enigmail-Version 1.5
OpenPGP id=78D0B871
Xref csiph.com comp.lang.python:39873

Show key headers only | View raw


Hi

I have a script which calls getLogger to set up a logging service.
The standard logger description used both the consoleHandler and the
syslogHandler.

It seems that if syslogd is shut down, getLogger fails, and the script
won't be able to log at all.

is there a way to make it immune against this and automatically continue
the consoleHandler. Sure, we could amend the .ini file
to remove the syslogHandler from the logger definition when this is
known, but on a cron-initiated script this is not feasible.

below is the logger definition:

> [loggers]
> keys=root,mylogger
> 
> [handlers]
> keys=consoleHandler,syslogHandler,rootHandler
> 
> [formatters]
> keys=simpleFormatter,syslogFormatter,rootFormatter
> 
> [logger_root]
> level=NOTSET
> handlers=rootHandler
> 
> [logger_mylogger]
> level=INFO
> handlers=consoleHandler,syslogHandler
> #handlers=syslogHandler
> #handlers=consoleHandler
> qualname=mylogger
> propagate=0
> 
> [handler_rootHandler]
> class=StreamHandler
> level=DEBUG
> formatter=rootFormatter
> args=(sys.stdout,)
> 
> [handler_consoleHandler]
> class=StreamHandler
> level=DEBUG
> formatter=simpleFormatter
> args=(sys.stdout,)
> 
> [handler_syslogHandler]
> class=handlers.SysLogHandler
> formatter=syslogFormatter
> level=INFO
> #args=(('localhost', handlers.SYSLOG_UDP_PORT), handlers.SysLogHandler.LOG_USER)
> args=('/dev/log', handlers.SysLogHandler.LOG_USER)


thanks

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

protect logger from shutdown syslogd Mathias Kőrber <mathias@koerber.org> - 2013-02-25 13:34 +0800

csiph-web