I have found the trick :

Configuring CXF Logging To Go Through Log4J

Apparently, CXF <http://incubator.apache.org/cxf> has chosen the JSE logging
API<http://java.sun.com/j2se/1.4.2/docs/api/java/util/logging/package-summary.html>as
their API against logging. But you can make CXF log through
Log4J <http://logging.apache.org/log4j/> quite easily. In the
org.apache.cxf.common.logging<http://incubator.apache.org/cxf/javadoc/latest/org/apache/cxf/common/logging/package-summary.html>package
of the CXF apidocs, I found the
Log4JLogger<http://incubator.apache.org/cxf/javadoc/latest/org/apache/cxf/common/logging/Log4jLogger.html>class,
which is a specialization of the JSE logging api
java.util.logging.Logger<http://java.sun.com/j2se/1.4.2/docs/api/java/util/logging/Logger.html>class,
delegating logging to a Log4J implementation.
Configuring Log4J in CXF

In the same package as
Log4JLogger<http://incubator.apache.org/cxf/javadoc/latest/org/apache/cxf/common/logging/Log4jLogger.html>,
I also found the
LogUtils<http://incubator.apache.org/cxf/javadoc/latest/org/apache/cxf/common/logging/LogUtils.html>class,
which CXF uses to obtain logger instances from. This class also
contains a static final string KEY, which is set to the value
org.apache.cxf.Logger. CXF uses this value, to bootstrap which logging API
to use.

You can either put a META-INF/cxf/org.apache.cxf.Logger file onto the
classpath with the org.apache.cxf.common.logging.Log4jLogger class name in
it as a single line, or you can supply a
-Dorg.apache.cxf.Logger=org.apache.cxf.common.logging.Log4jLogger system
property to your code, when executing.


Regards,

Charles Moulliard
Senior Enterprise Architect
Apache Camel Committer

*****************************
blog : http://cmoulliard.blogspot.com
twitter : http://twitter.com/cmoulliard
Linkedlin : http://www.linkedin.com/in/charlesmoulliard

Apache Camel Group :
http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm


On Thu, Feb 18, 2010 at 9:16 AM, Claus Ibsen <[email protected]> wrote:

> On Thu, Feb 18, 2010 at 9:09 AM, Charles Moulliard <[email protected]>
> wrote:
> > Hi,
> >
> > It is possible to use the class LoggingFeature of CXF inside the Camel
> CXF
> > Endpoint to log the IN/OUT traffic coming from/to CXF using the following
> > bean declaration in the camel cxf:bean defintion : <bean
> > class="org.apache.cxf.feature.LoggingFeature"/>
> >
> > Unfortunately, this class send the IN/OUT information to the System.out
> > console.
> >
> > Does anybody knows a workaround in camel spring DSL to send this
> information
> > to a log file using log4j ?
> >
>
> You should ask at CXF as its a CXF feature. Maybe you can configure it
> to tell it to use the Logging API from the JDK which can be diverted
> to log4j.
>
>
> > Kinds regards,
> >
> > Charles Moulliard
> > Senior Enterprise Architect
> > Apache Camel Committer
> >
> > *****************************
> > blog : http://cmoulliard.blogspot.com
> > twitter : http://twitter.com/cmoulliard
> > Linkedlin : http://www.linkedin.com/in/charlesmoulliard
> >
> > Apache Camel Group :
> > http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm
> >
>
>
>
> --
> Claus Ibsen
> Apache Camel Committer
>
> Author of Camel in Action: http://www.manning.com/ibsen/
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
>

Reply via email to