RotatingFileHandler key error when parsing a logging config file
Vinay Sajip
vinay_sajip at yahoo.co.uk
Tue Dec 22 15:06:51 EST 2009
On Dec 21, 9:33 pm, jordilin <jordi... at gmail.com> wrote:
> Hi,
> I've a config forloggingwhere I set up a file rotation with
> handlers.RotatingFileHandler and when the app parses thelogging
> config it says keyError when trying to parse that section
> ('RotatingFileHandler' is not defined). Curiously enough, I can do
> importloggingand fromlogging.handlers import RotatingFileHandler.
>
> Example:
>
> [handlers]
> keys=handlers.RotatingFileHandler
>
> [formatters]
> keys=simpleFormatter
>
> [logger_root]
> level=DEBUG
> handlers=handlers.RotatingFileHandler
>
> [handler_handlers.RotatingFileHandler]
> class=handlers.RotatingFileHandler
> level=DEBUG
> formatter=simpleFormatter
>
> I'm using python 2.4 in the servers. I'm having this in a particular
> one, which seems like there must be some kind of configuration error.
> Any suggestions,
> Thanks
Can you show the error message/traceback which you're getting? With
earlier versions of the logging package, handler class names were
evaluated in the context of the logging module (so
handlers.RotatingFileHandler should work). Later versions (than 2.4)
will try to resolve using normal import mechanisms, so
foo.bar.MyHandler should work.
It does seem like a configuration error (esp. if this same code works
on other machines running Python 2.4), but it's hard to say what it is
with the information you've provided so far.
Regards,
Vinay Sajip
More information about the Python-list
mailing list