Hello, I'm trying to setup simple Syslog logging in python using the logging module. I would like to use a config file, but so far haven't been able to get the correct configuration. Actually, I don't get any warnings or errors, program runs fine, but nothing is logged anywhere. I have my syslog LOCAL6 setup to go to /var/log/scripts.log, and that worked fine during testing of the syslog module. But logging gives me more flexibility, I'd rather use that.
Anyone with some experience using this module? The documentation, at least to me, is a bit confusing, and I haven't found a good example on the web yet. ---main.py--- #!/usr/bin/env python import logging, logging.config logging.config.fileConfig('logging.conf') log = logging.getLogger() log.info('here we go, testing logger') --- end main.py --- --- logging.conf --- [formatters] keys: detailed,simple [handlers] keys: console,syslog [loggers] keys: root [formatter_simple] format: %(name)s:%(levelname)s: %(message)s [formatter_detailed] format: %(name)s:%(levelname)s %(module)s:%(lineno)d: %(message)s [handler_console] class: StreamHandler args: [] formatter: simple [handler_syslog] class: handlers.SysLogHandler args: [('localhost', handlers.SYSLOG_UDP_PORT), handlers.SysLogHandler.LOG_LOCAL6 ] formatter: detailed [logger_root] level: INFO handlers: syslog ---- end logging.conf --- Thanks for any help! jay
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor