Skip to content

Instantly share code, notes, and snippets.

@timhughes
Created April 11, 2014 11:51
Show Gist options
  • Save timhughes/10461787 to your computer and use it in GitHub Desktop.
Save timhughes/10461787 to your computer and use it in GitHub Desktop.
Python logging to syslog
import logging
import logging.handlers
my_logger = logging.getLogger('MyLogger')
my_logger.setLevel(logging.DEBUG)
handler = logging.handlers.SysLogHandler('localhost', 514)
my_logger.addHandler(handler)
for i in range(20):
my_logger.debug('i = %d' % i)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment