|log = logging.getLogger(__name__)|
|handler = logging.handlers.SysLogHandler(address = '/dev/log')|
|formatter = logging.Formatter('%(module)s.%(funcName)s: %(message)s')|
|log.debug('this is debug')|
|log.critical('this is critical')|
|if __name__ == '__main__':|
This comment has been minimized.
This comment has been minimized.Show comment Hide comment
@khurshid-alam I think you misunderstand the intent of the code. This demonstrates the origination of NEW messages, written to syslog.
I think what you are really asking is "how can take stderr from an existing script, and redirect that to syslog?" If so: http://urbanautomaton.com/blog/2014/09/09/redirecting-bash-script-output-to-syslog/ (or some variant of that for your use case...)