Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The <a href="http://docs.oracle.com/javase/8/docs/api/java/util/logging/package-summary.html" rel="noreferrer"><code>java.util.logging</code> package</a> is standard in <a href="https://en.wikipedia.org/wiki/Java_Platform,_Standard_Edition" rel="noreferrer">Java SE</a>. Its <a href="https://docs.oracle.com/javase/8/docs/api/java/util/logging/Logger.html" rel="noreferrer"><code>Logger</code></a> includes an overloaded log method that accepts <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html" rel="noreferrer"><code>Throwable</code></a> objects. It will log stacktraces of exceptions and their cause for you.</p> <p>For example:</p> <pre><code>import java.util.logging.Level; import java.util.logging.Logger; [...] Logger logger = Logger.getAnonymousLogger(); Exception e1 = new Exception(); Exception e2 = new Exception(e1); logger.log(Level.SEVERE, "an exception was thrown", e2); </code></pre> <p>Will log:</p> <pre class="lang-none prettyprint-override"><code>SEVERE: an exception was thrown java.lang.Exception: java.lang.Exception at LogStacktrace.main(LogStacktrace.java:21) Caused by: java.lang.Exception at LogStacktrace.main(LogStacktrace.java:20) </code></pre> <p>Internally, this does exactly what @philipp-wendler suggests, by the way. See the <a href="http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/util/logging/SimpleFormatter.java?av=h#90" rel="noreferrer">source code for <code>SimpleFormatter.java</code></a>. This is just a higher level interface.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload