HOWTO · Java

How to Limit Java SSL Debug Logging

Today, we will learn about Java SSL debug, its importance, various utilities and how to use one or multiple in a single command.

On this page

Java SSL/TLS debug logging can reveal handshake, certificate, and record details when a connection fails. It can help narrow down what the JVM is doing, but it may not identify problems outside the TLS exchange.

Why Java SSL Debug Logging Helps Troubleshoot Connections

Set the javax.net.debug system property when starting the JVM. The broad -Djavax.net.debug=ssl argument enables SSL-related diagnostics and can produce substantial output, so use it for a focused investigation and review the logs before sharing them. Detailed connection logs may contain sensitive information.

Add the argument to the JVM options for your application. For an application server, update its startup configuration and restart the server; changing the option does not affect a JVM that is already running.

Limit Java SSL Debug Logging with Debug Specifiers

To narrow the diagnostics, append a specifier to the property value. For example, -Djavax.net.debug=ssl:handshake requests SSL handshake diagnostics. A multiple-specifier form is -Djavax.net.debug=ssl:handshake,record,session. These are representative forms: supported specifiers, separators, and details can vary across Java runtimes. Check the documentation for the JVM you run if an option is not recognized or does not produce the expected detail.

The following supplied specifiers describe common diagnostic areas. Availability and the amount of detail can differ by runtime; all can be especially noisy.

Debug specifier Diagnostic purpose
all Broad debugging across supported areas.
ssl SSL/TLS-related debugging.
record Record-level tracing; useful when investigating protocol data.
handshake Handshake message tracing.
keygen Key generation details.
session Session activity.
defaultctx Default SSL context initialization.
sslctx SSL context tracing.
sessioncache Session cache activity.
keymanager Key manager activity.
trustmanager Trust manager activity.
data Hexadecimal data for handshake messages, where supported.
verbose More detailed handshake message output, where supported.
plaintext Plaintext record data, where supported. Treat this output as sensitive.
packet Raw SSL/TLS packet details, where supported.

Start with the narrowest specifier that fits the question, then remove the JVM option when the investigation is complete. These JVM launch arguments are configuration examples, and no execution evidence is provided for their runtime behavior or output.