Is there a Logger that will easily log my stacktrace (what I get with
ex.printStackTrace()
)? I ve searched the log4j docs and found nothing
about logging the stacktrace.
我可以自己做这件事。
StringWriter sw = new StringWriter();
ex.printStackTrace(new PrintWriter(sw));
String stacktrace = sw.toString();
logger.error(stacktrace);
但我不想在各处复制此代码。
If log4j won t do this for me is there another logging package that will log the stacktrace for me?
谢谢。