Locked SSL log levels in Net::APNS
Recently we started working on an improvement of our Apple push notification service and we noticed that there is a massive log generated by that service. It didn’t take that long to find out the reason why this happens.
Here is a brief extract from the log:
And on and on and on until it writes 113225 lines and this get logged on every single iteration! Everyone who has played around with SSL and Perl, definitely knows what the DEBUG of Net::SSLeay looks like and how to switch it off. But there was only one problem - there was no option which allows us to do that in the code which uses the SSL module. Even worse - it was hard coded to the highest possible value. And it gets set inside the method which is sending the message so there is no way for this to be changed from outside that method.
We had a look at the code of Net::APNS::Notification and there was an easy way to implement a change to give back control of the SSL debug values. By simply converting the SSL version and debug to accessors, it makes possible to have as much debug information as we want and bring the control of the values out of the scope of the method which uses them.
In order to be backward compatible we set the default values of these accessors to be exactly the same as it was, so as not to stress people out about where their logs have gone :)
See the updated code at https://github.com/haoyayoi/Net-APNS. Many thanks to haoyayoi for merging our patch, we’re looking forward to the next release of Net-APNS!