homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: logging.config: Does not check logging.handlers for handlers
Type: Stage:
Components: None Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: vinay.sajip Nosy List: tleslie, vinay.sajip
Priority: normal Keywords:

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:05adminsetgithub: 40544
2004年07月12日 05:07:24tlesliecreate

AltStyle によって変換されたページ (->オリジナル) /