cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Kulp <dk...@apache.org>
Subject Re: CXF logging....
Date Tue, 27 Oct 2009 17:16:04 GMT
On Tue October 27 2009 1:10:36 pm Benson Margulies wrote:
> Why not just switch to sfl4j, defaulting to the j.u.l module?

Cause that's a TON of work.   All logging in CXF would need to change.  Plus, 
SLF4J is not i18n enabled at all.   Thus, all the places we use the 
Message.properties files for logging messages would need to be updated to 
handle the i18n stuff themselves instead of letting the logger do it. 

We could wrapper a SLF4J logger with a j.u.l Logger API like we do for Log4J, 
but that seems kind of silly to do j.u.l -> SLF4J -> j.u.l. 

Dan



> 
> On Tue, Oct 27, 2009 at 11:54 AM, Daniel Kulp <dkulp@apache.org> wrote:
> > As everyone is probably aware, CXF uses the j.u.l API for all of it's
> > logging.
> > That's really not likely to change, but we do allow logging to Log4J by
> > setting some system properties or a file in META-INF/cxf.
> >
> > However,   I was thinking it might make sense to try and detect where
> > SLF4J is
> > logging and if it's logging to Log4J, we should as well.    The
> > reflection code to do that isn't very complex:
> >
> > Class.forName("org/slf4j/impl/StaticLoggerBinder");
> > Class<?> cls = Class.forName("org.slf4j.LoggerFactory");
> > Class<?> fcls =
> > cls.getMethod("getILoggerFactory").invoke(null).getClass(); if
> > (fcls.getName().contains("Log4j")) {
> >    cname = "org.apache.cxf.common.logging.Log4jLogger";
> > } else if (fcls.getName().contains("JCL")) {
> >    cls = Class.forName("org.apache.commons.logging.LogFactory");
> >    fcls = cls.getMethod("getFactory").invoke(null).getClass();
> >    if (fcls.getName().contains("Log4j")) {
> >        cname = "org.apache.cxf.common.logging.Log4jLogger";
> >    }
> > }
> >
> > What are peoples thoughts on doing that?  That way, if SLF4J is logging
> > to Log4J, or if SLF4J is logging to JCL which is logging to Log4J, we
> > would log
> > to Log4J as well.    If SLF4J is logging to someplace else, we'd still
> > log to
> > j.u.l so that wouldn't change.
> >
> > One note: with PAX logging in servicemix/felix, the ILoggerFactory would
> > not
> > contain "Log4j".  Thus, we'd continue to use j.u.l.  But that is OK as
> > PAX logging already interceptor j.u.l and directs them to the same place.
> >
> > Thoughts?  Comments?
> >
> > --
> > Daniel Kulp
> > dkulp@apache.org
> > http://www.dankulp.com/blog
> 

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

Mime
View raw message