users@jersey.java.net

[Jersey] Re: logging all web service calls

From: Michael Iles <michael.iles_at_gmail.com>
Date: Fri, 31 Jan 2014 12:27:25 -0500

For Jersey 2 also look at org.glassfish.jersey.filter.LoggingFilter
which can log all request and response bodies. Add this line to your
application class derived from ResourceConfig:

    registerInstances(new
LoggingFilter(java.util.logging.Logger.getLogger("myLogger"), true));

Mike.

On 31 January 2014 12:12, phil swenson <phil.swenson_at_gmail.com> wrote:
> thanks! I'll take a look
>
>
> On Fri, Jan 31, 2014 at 10:03 AM, Paul K Moore <paulkmoore_at_gmail.com> wrote:
>>
>> Phil,
>>
>> CDI Interceptors (as opposed to Jersey interceptors) may be what you are
>> looking for; useful for cross-cutting concerns.
>>
>> See http://docs.oracle.com/javaee/6/tutorial/doc/gkhjx.html for starters...
>>
>> Paul
>>
>> On 31 Jan 2014, at 16:55, phil swenson <phil.swenson_at_gmail.com> wrote:
>>
>> I want to implement logging for all my web service calls....
>>
>> It seems redundant (not DRY) to put in a bunch of code for every web
>> service call like:
>>
>> LogUtil.debug("service X called, params =
>> var1:value1,var2:value2,var3:value3");
>>
>> Has anyone implemented this type of logging for jersey? a @LogMethodCall
>> annotation or something....
>>
>> This may not be a jersey question I guess, and Java may not allow such
>> things.
>>
>> thanks for any thoughts....
>>
>>
>