I'm using slf4j/log4j in my java application.
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:
catch (AnException ex) {
logger.error("An exception occurred", ex);
}
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.
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.
Anyone know how can I do it?