SLF4J-LOG4J How to save in the log file also the uncaught exceptions
<p><BR/>
I'm using slf4j/log4j in my java application. <BR/>
My problem is that for now I'm able only to log exceptions stack traces calling the appropriate logger method in the catch section of a try catch like:</p>

<pre><code>catch (AnException ex) {
    logger.error("An exception occurred", ex); 
}
</code></pre>

<p>I would like to put in the log file also the runtime exception for which I didn't put any cacth, like NullPointerException or NumberFormatException.<BR/>
As they are shown in the console I guess that there is a manner to redirect this stream from the console to the SLF4J logger. <BR/>
Anyone know how can I do it?</p>