Syslog

Michael Bentley michael at jedimindworks.com
Thu Aug 23 16:33:52 EDT 2007


On Aug 20, 2007, at 4:56 PM, greg wrote:

> Hi All,
>
> Could anyone tell me how I could syslog to a specific log (e.g. /var/
> log/daemon.log, /var/log/syslog.log...)?
>

# something like this:

import logging
logging.basicConfig(level=logging.DEBUG,
                     format='%(asctime)s %(levelname)-8s %(message)s',
                     datefmt='%a, %d %b %Y %H:%M:%S',
                     filename='/var/log/whatever.log',
                     filemode='a')

logging.info('random message')

hth,
Michael
---
# Something just doesn't seem right in those
# "Every kiss begins with 'K'" commercials.

 >>> 'Every Kiss'.startswith('K')
False







More information about the Python-list mailing list