Inspectopedia 2025.2 Help

'Throwable' printed to 'System.out'

Reports calls to System.out.println() with an exception as an argument.

Using print statements for logging exceptions hides the stack trace from you, which can complicate the investigation of the problem. It is recommended that you use logger instead.

Calls to System.out.print(), System.err.println(), and System.err.print() with an exception argument are also reported. It is better to use a logger to log exceptions instead.

The provided quick-fix supports SLF4J and Log4j 2. It replaces System.out.println() call with log calls

Example:

try { foo(); } catch (Exception e) { System.out.println(e); }

After the quick-fix is applied:

try { foo(); } catch (Exception e) { log.error("e: ", e); }

Locating this inspection

By ID

Can be used to locate inspection in e.g. Qodana configuration files, where you can quickly enable or disable it, or adjust its settings.

ThrowablePrintedToSystemOut
Via Settings dialog

Path to the inspection settings via IntelliJ Platform IDE Settings dialog, when you need to adjust inspection settings directly from your IDE.

Settings or Preferences | Editor | Inspections | Java | Code maturity

Use the Log method for fix option to specify a method which it is used to log a message.

Inspection options

Here you can find the description of settings available for the 'Throwable' printed to 'System.out' inspection, and the reference of their default values.

Log method for fix

Default value:

error

Other available settings:

  • trace

  • debug

  • info

  • warn

Suppressing Inspection

You can suppress this inspection by placing the following comment marker before the code fragment where you no longer want messages from this inspection to appear:

//noinspection ThrowablePrintedToSystemOut

More detailed instructions as well as other ways and options that you have can be found in the product documentation:

Inspection Details

By default bundled with:

IntelliJ IDEA 2025.2, Qodana for JVM 2025.2,

Last modified: 18 September 2025