How to wrap error tracing inside Log.Severe ()

I am using java.util.logging.Logger

to enter the engine application. Usually all I have to do to get my errors is to call e.printStackTrace()

. Except that I get nothing when I make a call from a worker thread that belongs to Task Queue

. But the task queue displays all entries made with LOG.info()

. So my question is, how do I do the stack trace internally LOG.severe()

? Below is the address instead of the route itself:

private static final Logger LOG = Logger.getLogger(LuceneWorker.class.getName());

//later inside a method
LOG.severe(e.getStackTrace().toString());

      

+3


source to share


1 answer


Logger#severe(msg)

is just a convenience method to Logger#log(Level.SEVERE, msg)

use this method instead.



LOG.log(Level.SEVERE, "Your Log Message", e);

      

+1


source







All Articles