mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 22:51:17 +07:00
31 lines
1.0 KiB
HTML
31 lines
1.0 KiB
HTML
<html>
|
|
<body>
|
|
Reports calls to <code>System.out.println()</code> with an exception as an argument.
|
|
<p>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.</p>
|
|
<p>Calls to <code>System.out.print()</code>, <code>System.err.println()</code>, and <code>System.err.print()</code> with an exception argument are also
|
|
reported. It is better to use a logger to log exceptions instead.</p>
|
|
<p>The provided quick-fix supports <b>SLF4J</b> and <b>Log4j 2</b>.
|
|
It replaces <code>System.out.println()</code> call with log calls</p>
|
|
<p><b>Example:</b></p>
|
|
<pre><code>
|
|
try {
|
|
foo();
|
|
} catch (Exception e) {
|
|
System.out.println(e);
|
|
}
|
|
</code></pre>
|
|
<p>After the quick-fix is applied:</p>
|
|
<pre><code>
|
|
try {
|
|
foo();
|
|
} catch (Exception e) {
|
|
log.error("e: ", e);
|
|
}
|
|
</code></pre>
|
|
<!-- tooltip end -->
|
|
<p>
|
|
Use the <b>Log method for fix</b> option to specify a method which it is used to log a message.
|
|
</p>
|
|
</body>
|
|
</html> |