I am facing the same problem. I implemented the ExceptionMapper
interface and add it to Jersey, then i logged all exception there
through my own log framework.
And also i use slf4j-over-jul to briage the JUL to my own log framework.
I think Jersey should at least let the developers configurate the log framework.
2012/11/1 Marek Potociar <marek.potociar_at_oracle.com>:
> Jersey will log all the unhandled exceptions, but we do not have a
> configurable logging. We rely on standard Java SE Logging API. To configure
> Jersey logging, in Jersey 1.x the logger root is "com.sun.jersey", in Jersey
> 2.x it is "org.glassfish.jersey".
>
> ...but in your case I would still opt for the try-catch block in your
> resource. If you have more such resources or methods, another alternative
> would be to convert your resources to CDI-managed beans and provide a CDI
> method interceptor that would do the logging (obviously you'll need to run
> in a CDI-enabled environment).
>
> Marek
>
>
>
> On Oct 30, 2012, at 2:59 PM, "Ryabin, Thomas" <Thomas.Ryabin_at_McKesson.com>
> wrote:
>
> 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
>
>