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.

Author panos.black
Recipients docs@python, panos.black, vinay.sajip
Date 2014-10-15.18:09:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1413396570.86.0.25871256892.issue22646@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2014-10-15 18:09:30panos.blacksetrecipients: + panos.black, vinay.sajip, docs@python
2014-10-15 18:09:30panos.blacksetmessageid: <1413396570.86.0.25871256892.issue22646@psf.upfronthosting.co.za>
2014-10-15 18:09:30panos.blacklinkissue22646 messages
2014-10-15 18:09:30panos.blackcreate