[ python-Bugs-989199 ] logging.config: Does not check logging.handlers for handlers

SourceForge.net noreply at sourceforge.net
Mon Jul 12 15:23:35 CEST 2004


Bugs item #989199, was opened at 2004-07-12 15:07
Message generated for change (Comment added) made by tleslie
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=989199&group_id=5470

Category: None
Group: None
Status: Closed
Resolution: Invalid
Priority: 5
Submitted By: Tim Leslie (tleslie)
Assigned to: Vinay Sajip (vsajip)
Summary: logging.config: Does not check logging.handlers for handlers

Initial Comment:
In fileConfig(), only the logging module is checked for
handler names.

klass = eval(klass, vars(logging))
...
args = eval(args, vars(logging))

This prevents the user from using handlers which are
defined in logging.handlers. 

A quick and dirty fix that seems to work for me is

klass = eval(klass, dict(vars(logging).items() +
vars(logging.handlers).items()))
...
args = eval(args, dict(vars(logging).items() +
vars(logging.handlers).items()))

This is almost certainly not the best way to do it, but
it Works For Me (TM)

----------------------------------------------------------------------

>Comment By: Tim Leslie (tleslie)
Date: 2004-07-12 23:23

Message:
Logged In: YES 
user_id=1081664

Ah ok, that works much better. I was mislead by the examples
given in the docs:

http://www.python.org/doc/lib/logging-config-fileformat.html

[handler_hand06]
class=NTEventLogHandler
level=CRITICAL
formatter=form06
args=('Python Application', '', 'Application')

and similarly for hand07, 08 and 09, the fully qualified
name is not used. Presumably the docs are in error here. If
this is the case, should I file a new bug, or can it be
handled from here?

----------------------------------------------------------------------

Comment By: Vinay Sajip (vsajip)
Date: 2004-07-12 19:30

Message:
Logged In: YES 
user_id=308438

You can put a qualified name in the config file - 
e.g. "handlers.HTTPHandler".

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=989199&group_id=5470


More information about the Python-bugs-list mailing list