Hi David
On 25/01/12 19:39, KARR, DAVID wrote:
-----Original Message-----
From: Daniel Kulp [mailto:[email protected]]
Sent: Wednesday, January 25, 2012 11:33 AM
To: [email protected]
Cc: KARR, DAVID
Subject: Re: How to turn off LoggingOutInterceptor with log4j?

On Wednesday, January 25, 2012 6:55:41 PM KARR, DAVID wrote:
In my JAX-RS server, I have both the LoggingInInterceptor and
LoggingOutInterceptor enabled.  I'd like to control whether these
actually
log by controlling log4j settings, particularly at runtime.  I tried
adding
a logger in my log4j.xml with name
"org.apache.cxf.interceptor.LoggingOutInterceptor" and level = "off",
but
that didn't appear to do anything.

What version of CXF are you using?    This was changed in 2.5 to allow
per-
service control of the logging.   See the very bottom of:

http://cxf.apache.org/docs/25-migration-guide.html

I'm currently on 2.4.2.  Is this new logging configuration specific to JAX-WS services?  
I'm using JAX-RS.  If it does work with JAX-RS, how do you translate 
"ServiceName.PortName.PortTypeName" to my REST service?

There could be a number of ways to control it dynamically at runtime.

Have a look at
http://svn.apache.org/repos/asf/cxf/branches/2.4.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingOutInterceptor.java

Perhaps one option is to extend LoggingOutInterceptor and in its custom handleMessage(Message) do not delegate to LoggingOutInterceptor if some condition is met. Alternatively an interceptor which runs just before LoggingOutInterceptor can set that LOG_SETUP property on the message which should also do it

I'll get back to you a bit later after experimenting with "ServiceName.PortName.PortTypeName", one can configure a jaxrs endpoint to get a custom service QName attached to it, I may need to update few things there to get per-jaxrs endpoint specific logging working

Cheers, Sergey

Reply via email to