What's wrong with my logging configuration
rambius
rambiusparkisanius at gmail.com
Sat Nov 27 16:07:11 EST 2010
Hello,
I am using python logging and as of today it stopped working. Here is
my program:
#!/usr/bin/env python
import base64
import getpass
import httplib
import logging
import logging.config
import sys
import urlparse
logging.config.fileConfig('logging.config')
logger = logging.getLogger(sys.argv[0])
def main():
from optparse import OptionParser
usage = '%prog -u <user> [options] <url>'
parser = OptionParser(usage=usage)
parser.add_option('-u', '--user',
help='The user that will be authenticated')
(options, args) = parser.parse_args()
if len(args) != 1:
logger.error('Please provide a url')
sys.exit(1)
url = args[0]
if not options.user:
logger.error('Please provide a user')
sys.exit(2)
password = getpass.getpass('Password: ')
if __name__ == '__main__':
main()
Here is my logging.config:
[loggers]
keys=root
[handlers]
keys=console,file
[formatters]
keys=consolefmt,filefmt
[formatter_consolefmt]
format=%(name)-12s: %(levelname)-8s %(message)s
class=logging.Formatter
[formatter_filefmt]
format=%(asctime)s %(name)-12s %(levelname)-8s %(message)s
datefmt=%d/%m/%Y %H:%M:%S
[handler_console]
class=StreamHandler
level=INFO
formatter=consolefmt
args=(sys.stdout,)
[handler_file]
class=FileHandler
level=DEBUG
formatter=filefmt
args=('dav.log', 'a')
[logger_root]
level=NOTSET
handlers=console,file
Yesterday, it was working and I have not touched it - logging has been
working for months. This morning it stopped working and I was
debugging it for half a day and I am clueless. It does not the errors
neither on the console nor in the log file.
I will appreciate any help! Thank you in advance!
Regards
Rambius
More information about the Python-list
mailing list