printing exception stack trace in log4j code example Example: log4j print stacktrace try { ... } catch (Exception e) { log.error( "failed!", e ); }