Thanks, I missed the Javadoc on CXF's website.
I've read this Class doc, as well as AbstractDelegatingLogger doc.
I now clearly get that CXF will use Java Logging by default, but in fact, _I
just want to configure its logger(s ?) to use FileHandler instead of the
ConsoleHandler, all of this programatically_.

I've tried this :
        Logger result = Logger.getLogger(name);
        result.setUseParentHandlers(false);
        Handler[] hdls = result.getHandlers();
            for( int i = 0; i < hdls.length; i++ ) {
                result.removeHandler(hdls[i]);
            }
        FileHandler hdl = new FileHandler(path, true);
        hdl.setFormatter(_DEFAULT_FORMAT);
        result.addHandler(hdl);
        result.setLevel(_DEFAULT_LEVEL);
        return result;

With name = one of what I think is a Logger CXF uses
(org.apache.cxf.interceptor.LoggingInInterceptor and
org.apache.cxf.interceptor.LoggingOutInterceptor), and path = the path of
the file I want to be the log.

This doesn't work .. I still have Console logged output, which is by the way
:

8 août 2008 15:48:12
org.apache.cxf.service.factory.ReflectionServiceFactoryBean
buildServiceFromClass
INFO: Creating Service {http://service.paradise/}PSIService from class
paradise.service.PSIService
8 août 2008 15:48:12 org.apache.cxf.endpoint.ServerImpl initDestination
INFO: Setting the server's publish address to be
http://localhost:9000/ParadiseServer
8 août 2008 15:48:12 sun.reflect.NativeMethodAccessorImpl invoke0
INFO: Logging to org.slf4j.impl.JDK14LoggerAdapter(org.mortbay.log) via
org.mortbay.log.Slf4jLog
8 août 2008 15:48:12 sun.reflect.NativeMethodAccessorImpl invoke0
INFO: jetty-6.1.9
8 août 2008 15:48:12 sun.reflect.NativeMethodAccessorImpl invoke0
INFO: Started [EMAIL PROTECTED]:9000

It's really annoying that it talks about "JDK14LoggerAdapter" ??! I use JDK
and JRE 1.5.

On Fri, Aug 8, 2008 at 16:18, Benson Margulies <[EMAIL PROTECTED]>wrote:

> The javadoc is on the web site. Or you can fetch the source. Many users
> find
> that reading the source is awfully useful.
>
> Here's the doc from the top of the class. As you can see, CXF already uses
> J.U.L by default. But it uses its own loggers based on its class names.
>
> /**
>  * A container for static utility methods related to logging.
>  * By default, CXF logs to java.util.logging. An application can change
> this. To log to another system, the
>  * application must provide an object that extends [EMAIL PROTECTED]
> AbstractDelegatingLogger}, and advertise that class
>  * via one of the following mechanisms:
>  * <ul>
>  * <li>Create a file, in the classpath, named
> META-INF/cxf/org.apache.cxf.Logger.
>  * This file should contain the fully-qualified name
>  * of the class, with no comments, on a single line.</li>
>  * <li>Call [EMAIL PROTECTED] #setLoggerClass(Class)} with a Class<?> 
> reference to the
> logger class.</li>
>  * </ul>
>  * CXF provides [EMAIL PROTECTED] Log4jLogger} to use log4j instead of
> java.util.logging.
>  */
>
>
>
> On Fri, Aug 8, 2008 at 9:58 AM, Shinkan <[EMAIL PROTECTED]> wrote:
>
> > Hi Benson.
> >
> > Where can I find that ?
> > I don't have it in my CXF .zip downloaded pack.
> > Googling it doesn't help.
> >
> > On Fri, Aug 8, 2008 at 15:41, Benson Margulies <[EMAIL PROTECTED]
> > >wrote:
> >
> > > Read the javadoc of
> > >
> > >
> >
> /cxf-common-utilities/src/main/java/org/apache/cxf/common/logging/LogUtils.java.
> > >
> > >
> > >
> > > On Fri, Aug 8, 2008 at 8:30 AM, Shinkan <[EMAIL PROTECTED]> wrote:
> > >
> > > > Hi everyone !
> > > >
> > > > I would like to log all the CXF verbose stuff on a file, which is
> > already
> > > > used for some other logging.
> > > > I created the log file programmatically through the Java SE Logger
> > class
> > > > (and I won't change that, it's a design choice to create it
> > > > programmatically).
> > > > So basically, I have a Logger, with an appender configured, all of
> this
> > > > programatically, and I would like CXF to use it _and nothing else_ to
> > log
> > > > messages.
> > > >
> > > > I use Simple Frontend, I guess that I must do something with
> > > > Logging(In|Out)Interceptor, but I don't know what :S
> > > >
> > > > Many thanks in advance.
> > > >
> > > > --
> > > > Pierre.
> > > > Some people, when confronted with a problem, think "I know, I'll use
> > > XML".
> > > > Now they have two problems. -- Jamie Zawinski / James Robertson
> > > >
> > >
> >
> >
> >
> > --
> > Pierre.
> > Some people, when confronted with a problem, think "I know, I'll use
> XML".
> > Now they have two problems. -- Jamie Zawinski / James Robertson
> >
>



-- 
Pierre.
Some people, when confronted with a problem, think "I know, I'll use XML".
Now they have two problems. -- Jamie Zawinski / James Robertson

Reply via email to