Say you catch an exception and get the following on the standard output (like, say, the console) if you do a e.printStackTrace() :
java.io.FileNotFo
In Log4j 2, you can use Logger.catching() to log a stacktrace from an exception that was caught.
try { String msg = messages[messages.length]; logger.error("An exception should have been thrown"); } catch (Exception ex) { logger.catching(ex); }