Issue 989199: logging.config: Does not check logging.handlers for handlers (original) (raw)

Created on 2004-07-12 05:07 by tleslie, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (4)
msg21509 - (view) Author: Tim Leslie (tleslie) Date: 2004-07-12 05:07
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)
msg21510 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2004-07-12 09:30
Logged In: YES user_id=308438 You can put a qualified name in the config file - e.g. "handlers.HTTPHandler".
msg21511 - (view) Author: Tim Leslie (tleslie) Date: 2004-07-12 13:23
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?
msg21512 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2004-07-12 15:51
Logged In: YES user_id=308438 Yes, it was a bug in the docs. Now fixed in CVS. Thanks.
History
Date User Action Args
2022-04-11 14:56:05 admin set github: 40544
2004-07-12 05:07:24 tleslie create