You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Shinkan <sh...@gmail.com> on 2008/08/08 14:30:47 UTC

Logging CXF with Programmatically Created Java Loggers

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

Re: Logging CXF with Programmatically Created Java Loggers

Posted by Daniel Kulp <dk...@apache.org>.
Try using the "name" of one of the log message in your log and seeing if that 
helps.   Example:
> 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

Try name="org.apache.cxf.service.factory.ReflectionServiceFactoryBean".

You could also try just doing something like:
name="org.apache.cxf"
The hiearchy stuff might pick that up as a parent.   Not really sure.

Now, SOME of those messages that you see are from SLF4J which is what jetty 
uses for Logging.


Dan




On Friday 08 August 2008 10:25:46 am Shinkan wrote:
> 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 SelectChannelConnector@0.0.0.0: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 <bi...@gmail.com>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 {@link
> > 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 {@link #setLoggerClass(Class)} with a Class<?> reference to
> > the logger class.</li>
> >  * </ul>
> >  * CXF provides {@link Log4jLogger} to use log4j instead of
> > java.util.logging.
> >  */
> >
> > On Fri, Aug 8, 2008 at 9:58 AM, Shinkan <sh...@gmail.com> 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 <bimargulies@gmail.com
> > >
> > > >wrote:
> > > >
> > > > Read the javadoc of
> >
> > /cxf-common-utilities/src/main/java/org/apache/cxf/common/logging/LogUtil
> >s.java.
> >
> > > > On Fri, Aug 8, 2008 at 8:30 AM, Shinkan <sh...@gmail.com> 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



-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog

Re: Logging CXF with Programmatically Created Java Loggers

Posted by Shinkan <sh...@gmail.com>.
Hey there !

I figured it all out by using Log4j.
I just have to add the "log4j.properties" configuration file somewhere in my
CLASSPATH.
Then, I have to tell org.apache.cxf to use Log4j logger. You have to set a
System property for that, I do it programatically :

protected static final String _LOG_CXF_DRIVER =
"org.apache.cxf.common.logging.Log4jLogger";
...
System.setProperty("org.apache.cxf.Logger", _LOG_CXF_DRIVER);

Then, if you use CXF in standalone context, you have to handle Jetty
messages which by default (following CXF simple frontend tutorials) come to
System.err, through Slf4j and JDK14 Logging.
To handle that, you just have to add the SLF4J's distribution
"slf4j-log4j12-1.5.2.jar" in your libs, and remove the "slf4j-jdk14" one
which comes with CXF's distribution. So now every SLF4J logging will be
handled by Log4j.

Just as an example, here is my log4j.properties :

# LOG COMMUN APACHE
log4j.logger.org.apache.commons = DEBUG, COMMONS
log4j.appender.COMMONS = org.apache.log4j.FileAppender
log4j.appender.COMMONS.file = log/commons.log
log4j.appender.COMMONS.layout = org.apache.log4j.PatternLayout
log4j.appender.COMMONS.layout.conversionPattern = %d [%t] %-5p %c - %m%n
log4j.appender.COMMONS.append = true

# LOG DE APACHE TORQUE
log4j.logger.org.apache.torque = DEBUG, DATA
log4j.appender.DATA = org.apache.log4j.FileAppender
log4j.appender.DATA.file = log/data.log
log4j.appender.DATA.layout = org.apache.log4j.PatternLayout
log4j.appender.DATA.layout.conversionPattern = %d [%t] %-5p %c - %m%n
log4j.appender.DATA.append = true

# LOG DE APACHE CXF et JETTY
log4j.logger.org.apache.cxf = DEBUG, NETWORK
log4j.logger.org.mortbay = DEBUG, NETWORK
log4j.appender.NETWORK = org.apache.log4j.FileAppender
log4j.appender.NETWORK.file = log/network.log
log4j.appender.NETWORK.layout = org.apache.log4j.PatternLayout
log4j.appender.NETWORK.layout.conversionPattern = %d [%t] %-5p %c - %m%n
log4j.appender.NETWORK.append = true

Thanks to all !


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

Re: Logging CXF with Programmatically Created Java Loggers

Posted by Ian Roberts <i....@dcs.shef.ac.uk>.
Shinkan wrote:
> It's really annoying that it talks about "JDK14LoggerAdapter" ??! I use JDK
> and JRE 1.5.

"JDK14" just means "the java.util.logging infrastructure that was 
introduced in Java 1.4", it's not saying that you are running 1.4 at the 
moment.

Ian

-- 
Ian Roberts               | Department of Computer Science
i.roberts@dcs.shef.ac.uk  | University of Sheffield, UK

Re: Logging CXF with Programmatically Created Java Loggers

Posted by Shinkan <sh...@gmail.com>.
Thanks for your support.

CXF doesn't seem to use the root logger as I already configured it
programmatically, and nothing from CXF comes inside ...
So hacking existing logs doesn't seem to work.
Maybe I can use LOG4J, because I use it for another lib, and I can use
config files there.
But how will I know which classes CXF needs LOG4J appenders for ?

On Fri, Aug 8, 2008 at 16:48, Benson Margulies <bi...@gmail.com>wrote:

> Our usual advice is to use the J.U.L configuration file. You don't want to
> do that.
>
> I would think that you would be able to simple hack the root logger and
> install your handlers there, but I don't know.
>
> You could create a subclass of AbstractDelegatingLogger and make it just
> turn around and use J.U.L under the control of your configuration.
>
> On Fri, Aug 8, 2008 at 10:25 AM, Shinkan <sh...@gmail.com> wrote:
>
> > 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<http://service.paradise/%7DPSIService>
> <http://service.paradise/%7DPSIService>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 SelectChannelConnector@0.0.0.0: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 <bimargulies@gmail.com
> > >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 {@link
> > > 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 {@link #setLoggerClass(Class)} with a Class<?> reference to
> > the
> > > logger class.</li>
> > >  * </ul>
> > >  * CXF provides {@link Log4jLogger} to use log4j instead of
> > > java.util.logging.
> > >  */
> > >
> > >
> > >
> > > On Fri, Aug 8, 2008 at 9:58 AM, Shinkan <sh...@gmail.com> 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 <
> bimargulies@gmail.com
> > > > >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 <sh...@gmail.com> 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
> >
>



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

Re: Logging CXF with Programmatically Created Java Loggers

Posted by Benson Margulies <bi...@gmail.com>.
Our usual advice is to use the J.U.L configuration file. You don't want to
do that.

I would think that you would be able to simple hack the root logger and
install your handlers there, but I don't know.

You could create a subclass of AbstractDelegatingLogger and make it just
turn around and use J.U.L under the control of your configuration.

On Fri, Aug 8, 2008 at 10:25 AM, Shinkan <sh...@gmail.com> wrote:

> 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<http://service.paradise/%7DPSIService>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 SelectChannelConnector@0.0.0.0: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 <bimargulies@gmail.com
> >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 {@link
> > 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 {@link #setLoggerClass(Class)} with a Class<?> reference to
> the
> > logger class.</li>
> >  * </ul>
> >  * CXF provides {@link Log4jLogger} to use log4j instead of
> > java.util.logging.
> >  */
> >
> >
> >
> > On Fri, Aug 8, 2008 at 9:58 AM, Shinkan <sh...@gmail.com> 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 <bimargulies@gmail.com
> > > >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 <sh...@gmail.com> 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
>

Re: Logging CXF with Programmatically Created Java Loggers

Posted by Shinkan <sh...@gmail.com>.
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 SelectChannelConnector@0.0.0.0: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 <bi...@gmail.com>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 {@link
> 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 {@link #setLoggerClass(Class)} with a Class<?> reference to the
> logger class.</li>
>  * </ul>
>  * CXF provides {@link Log4jLogger} to use log4j instead of
> java.util.logging.
>  */
>
>
>
> On Fri, Aug 8, 2008 at 9:58 AM, Shinkan <sh...@gmail.com> 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 <bimargulies@gmail.com
> > >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 <sh...@gmail.com> 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

Re: Logging CXF with Programmatically Created Java Loggers

Posted by Benson Margulies <bi...@gmail.com>.
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 {@link
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 {@link #setLoggerClass(Class)} with a Class<?> reference to the
logger class.</li>
 * </ul>
 * CXF provides {@link Log4jLogger} to use log4j instead of
java.util.logging.
 */



On Fri, Aug 8, 2008 at 9:58 AM, Shinkan <sh...@gmail.com> 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 <bimargulies@gmail.com
> >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 <sh...@gmail.com> 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
>

Re: Logging CXF with Programmatically Created Java Loggers

Posted by Shinkan <sh...@gmail.com>.
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 <bi...@gmail.com>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 <sh...@gmail.com> 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

Re: Logging CXF with Programmatically Created Java Loggers

Posted by Benson Margulies <bi...@gmail.com>.
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 <sh...@gmail.com> 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
>