Message229488
If you configure logging using a JSON file, then, after you parse it and you pass it to logging.config.dictConfig(), you realize that when you define an SMTPHandler you can't set "credentials", or, more precisely, whether you set it or not the credentials value is ignored.
This happens because SMTPHandler's __init__ has the following code
if isinstance(credentials, tuple):
self.username, self.password = credentials
else:
self.username = None
while "credentials" inside dictConfig() is a "ConvertingList" and not a "tuple". As a result, username is set to None.
I think that this is a problem because:
a) "credentials" is allowed to be specified in the configuration file (i.e. if you have an identifier that SMTPHandler's __init__, knows nothing about then you get an exception).
b) Other fields like, "timeout", and "toaddrs" work as expected (i.e. you can set them just fine)
c) This behaviour is not documented and you end up with improperly configured logging.
I guess that similar problems exist in other handlers too, but I haven't checked them one by one.
I think that it would make sense to be able to set all __init__ arguments in the Handlers section, or at least, if this is not desirable, to document this behaviour. |
|
Date |
User |
Action |
Args |
2014-10-15 18:09:30 | panos.black | set | recipients:
+ panos.black, vinay.sajip, docs@python |
2014-10-15 18:09:30 | panos.black | set | messageid: <1413396570.86.0.25871256892.issue22646@psf.upfronthosting.co.za> |
2014-10-15 18:09:30 | panos.black | link | issue22646 messages |
2014-10-15 18:09:30 | panos.black | create | |
|