Message57448
fileConfig crashes with a NameError when trying to configure a
RotatingFileHandler (I assume the same holds for other handlers defined
in logging.handlers). Using StreamHandler (from the logging package)
works fine. Most likely, I am missing something here, but if not, this
is a really bad joke...
RotatingFileHandler is available on my system, a qualified name must be
used:
Python 2.5.1 (r251:54869, Apr 18 2007, 22:08:04)
[GCC 4.0.1 (Apple Computer, Inc. build 5367)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import logging
>>> import logging.handlers
>>> RotatingFileHandler("test.log", "a", 5000, 5)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'RotatingFileHandler' is not defined
>>> logging.handlers.RotatingFileHandler("test.log", "a", 5000, 5)
<logging.handlers.RotatingFileHandler instance at 0x7940d0>
fileConfig crashes, with or without qualified names:
>>> import logging.config
>>> logging.config.fileConfig("test.ini")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/logging/config.py",
line 84, in fileConfig
handlers = _install_handlers(cp, formatters)
File
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/logging/config.py",
line 149, in _install_handlers
klass = eval(klass, vars(logging))
File "<string>", line 1, in <module>
NameError: name 'RotatingFileHandler' is not defined
>>> logging.config.fileConfig("test.qualified_name.ini")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/logging/config.py",
line 84, in fileConfig
handlers = _install_handlers(cp, formatters)
File
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/logging/config.py",
line 149, in _install_handlers
klass = eval(klass, vars(logging))
File "<string>", line 1, in <module>
NameError: name 'logging' is not defined
test.ini (in configurationFiles.zip):
---
[loggers]
keys=root
[handlers]
keys=fileHandler
[formatters]
keys=simpleFormatter
[logger_root]
level=DEBUG
handlers=fileHandler
[handler_fileHandler]
class=RotatingFileHandler
level=DEBUG
formatter=simpleFormatter
args=('test.log', 'a', 5000000, 5)
[formatter_simpleFormatter]
format=%(asctime)s - %(name)s - %(levelname)s - %(message)s
datefmt=
---
test.qualified_name.ini (in configurationFiles.zip):
---
[loggers]
keys=root
[handlers]
keys=fileHandler
[formatters]
keys=simpleFormatter
[logger_root]
level=DEBUG
handlers=fileHandler
[handler_fileHandler]
class=logging.handlers.RotatingFileHandler
level=DEBUG
formatter=simpleFormatter
args=('test.log', 'a', 5000000, 5)
[formatter_simpleFormatter]
format=%(asctime)s - %(name)s - %(levelname)s - %(message)s
datefmt=
--- |
|
Date |
User |
Action |
Args |
2007-11-13 12:41:46 | sebastian | set | spambayes_score: 0.00268502 -> 0.0026850172 recipients:
+ sebastian |
2007-11-13 12:41:46 | sebastian | set | spambayes_score: 0.00268502 -> 0.00268502 messageid: <1194957706.1.0.150807949301.issue1436@psf.upfronthosting.co.za> |
2007-11-13 12:41:45 | sebastian | link | issue1436 messages |
2007-11-13 12:41:45 | sebastian | create | |
|