title: How to include Exceptions and Errors in log4j
body: <p>I have made log4j appender that stores all logs into one file:</p>
  
  <pre><code>log.info("Hello world");
  </code></pre>
  
  <p>will store <code>Hello World</code> into the file. How I can make that even <strong>Exceptions</strong> are stored into that file as log. For example statement:</p>
  
  <pre><code>log.info(5 / 0);
  </code></pre>
  
  <p>should store whole stack from <code>DivisionByZero Exception</code> into file that is stated in log4j appender.</p>
  
  <p><strong>P.S.</strong> I know that I can put <code>log.info(e.printStackTrace())</code> into catch clause, but I want every catched and non-catched exception is logged. I am testing, so there are many exceptions that shouldn't be catched, just thrown. I need configuration, property, or any other statement related to log4j that will stream all exceptions into its appender.</p>
  
  <p><strong>P.S.S.</strong> I know I can redirect stderr output to file, but I don't want touch the console.</p>