users@jersey.java.net

[Jersey] How to configure Jersey to automatically log all exceptions?

From: Ryabin, Thomas <Thomas.Ryabin_at_McKesson.com>
Date: Tue, 30 Oct 2012 13:59:47 +0000

Hi,

I have a Jersey service that can throw various kinds of exceptions, and I would like to log every exception thrown along with its stacktrace. One way I could do this is to just surround the service method in a try/catch clause and log the exceptions that way. Could I configure Jersey to automatically log all exceptions thrown and avoid using a try/catch clause? I am using Logback as my logging framework, so I would like to be able to configure where the exceptions are logged by editing the logback.xml file.

-Thomas