Enabling SSL debugging in a standalone Java program

Solution Verified - Updated -


  • Java
    • OpenJDK
      • 1.6
      • 1.7
      • 1.8
    • Oracle Java runtime
      • 1.6
      • 1.7
      • 1.8


  • How to enable SSL debugging in a standalone Java program that makes SSL connections?


  • You can use the following as a java argument when starting a standalone Java client.
  • To get more filtered logging you can use:
-Djavax.net.debug=ssl:handshake:verbose:keymanager:trustmanager -Djava.security.debug=access:stack
java -Djavax.net.debug=ssl:handshake:verbose:keymanager:trustmanager -Djava.security.debug=access:stack  JavaHttpsClient https://example.com:port 1
  • To get decrypted HTTP requests/responses:
java -Djavax.net.debug=ssl:record:plaintext  JavaHttpsClient https://example.com:port 1

NOTE :https://example.com:port is the server being invoked host and HTTPS port. This can also be anything like https://www.redhat.com. Also, "1" means the number of calls. In the above example it is only a single call.

  • To show available options which can be set to javax.net.debug:
java -Djavax.net.debug=help JavaHttpsClient https://redhat.com/ 1


This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.


See [1] for a complete list of SSL related javax.net.debug options

[1] http://stackoverflow.com/questions/23659564/limiting-java-ssl-debug-logging

I believe the best source for the complete list of options for javax.net.debug is http://docs.oracle.com/javase/7/docs/technotes/guides/security/jsse/JSSERefGuide.html#Debug