logging - Stack trace prints everything on one line in log file (Java) -
i have program creates log file, , outputs stack trace of exception thrown. however, stack trace printed on single line. ideas on how break up, without manually catching exception , breaking line line? or how slf4j logs text file?
log file
07-25-2013 11:11:27 [loggererror] - error - [exception] java.sql.sqlexception, [stack trace] [com.***.********.******.************.<init>(************.java:195), ***.***.*******.****.***********.main(***********.java:210)]
code logging
loggererror.error("[exception] {}, \n[stack trace] {}", e, e.getstacktrace());
using myeclipse, logging slf4j appreciated
you use java's logger.
with logger, should trick:
logger = logger = logger.getlogger(<yourclass>); logger.log(level.severe, <your message>, e);
if want the hard way should keep in mind getstacktrace() returns array, you'll have process it.
Comments
Post a Comment