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
You pass the exception directly to the logger, e.g.
try { ... } catch (Exception e) { log.error( "failed!", e ); }
It's up to log4j to render the stack trace.