Print call can be replaced with a logpoint
Reports System.out.println() and IO.println() calls which can be replaced with a Logpoint. Logpoints are a debugger feature to print expressions to standard output without requiring changes to the source code. The advantages of Logpoints:
Can be added, modified, and removed during execution, no need to HotSwap
Can be used in library code, which usually can't be changed
When a Logpoint contains invalid (uncompilable) code, the program remains runnable
No risk of leaking printing calls into production, as logpoints are not part of the source code
The inspection only reports when there's another executable line available, that is not a loop statement, to put the Logpoint.
NOTE: Logpoints only work when Debugging. Under Run, Run with Coverage and Profile modes, logpoint expressions won't appear in the output.
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.
JavaPrintToLogpoint- 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.
Inspection ID: JavaPrintToLogpoint
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:
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: |