How to enable or implement logging for HttpsURLConnection traffic on Android? -
I need to be able to log in (at least) the header and (optionally) encrypted messages HttpsURL connection to my application in the body. It should be similar.
Is this an easy way to do (like set some flags to enable it)?
complex work solution
implemented custom SSLSocketFactory and subclass of SSLSocket, from delegate class use.
You can download a demo project and see how it works.
Simple non-working solution
The SSL layer implementation has self-logging code, which uses the org.apache.harmony.xnet.provider.jsse.Logger class. It reads the names of parameters from the JSSE system property, if defined, then comma-separated list of values can be conn_state, prf, alert, ssocket, record, engine and socket.
By default, this system instructs the output to err.
So I started the
$ adb shell stop $ ADB open setprop.log.redirect -stdio true $ adb but ( I think) jsse failed to start the system property before being used by the logger class. Out of the three options: Set up with ADB Shell setprop, create /data/local.prop and set the system in the static starter of the main activity class. With Setup Suite, only the latter option is successful (at least getProperty () After this fixed value was returned).
Please, know, if you have succeeded from another point of view
Comments
Post a Comment