[slf4j-user] logging a stack trace along with a parameterized string

Lowell Kirsh lowellk at gmail.com
Mon Dec 17 22:47:46 CET 2007


Looking at the API, I can't figure out how to log an exception's stack trace
along with a parameterized string. What I want is something like:

...
catch (FooException e) {
  LOG.debug("Got a {} with value {}", e.getClass().getName(), e.getValue(),
e);
}

But it seems from the API that I can either pass a Throwable to the log
method, or some arguments to be interpolated into the String. Is there an
idiom for doing both?

Thanks,
Lowell
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://qos.ch/pipermail/slf4j-user/attachments/20071217/172e0ab1/attachment.htm>


More information about the slf4j-user mailing list