import java.io.StringWriter;import java.io.PrintWriter;//Two lines of code to get the exception into a StringWriterStringWriter sw =newStringWriter();newThrowable().printStackTrace(newPrintWriter(sw));//And to actually print it
logger.info("Current stack trace is:\n"+ sw.toString());

java.io.FileNotFoundException:/(Is a directory)
at java.io.FileOutputStream.open0(NativeMethod)
at java.io.FileOutputStream.open(FileOutputStream.java:270)
at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
at java.io.FileOutputStream.<init>(FileOutputStream.java:101)
at Test.main(Test.java:9)

El trace String se mantiene, cuando se imprime en stdout

java.io.FileNotFoundException:/(Is a directory)
at java.io.FileOutputStream.open0(NativeMethod)
at java.io.FileOutputStream.open(FileOutputStream.java:270)
at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
at java.io.FileOutputStream.<init>(FileOutputStream.java:101)
at Test.main(Test.java:9)