Configuring CXF Logging To Go Through Log4J
Apparently, CXF has chosen the JSE logging API as their API against logging. But you can make CXF log through Log4J quite easily. In the org.apache.cxf.common.logging package of the CXF apidocs, I found the Log4JLogger class, which is a specialization of the JSE logging api java.util.logging.Logger class, delegating logging to a Log4J implementation.
Configuring Log4J in CXF
In the same package as Log4JLogger, I also found the LogUtils 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.


[...] messages through its logging API. As a standard, the logging API in CXF is JDK logging, but you can configure CXF to use Log4J logging instead. You will need to ensure, that at least INFO level logging has been enabled for these [...]
January 30th, 2008 at 21:51[...] mentioned in my post on how to configure log4j as logging engine in cxf, cxf comes out of the box with JavaSE logging (java.util.logging) as its logging engine. If you [...]
February 28th, 2008 at 21:27I can’t find META-INF/cxf/org.apache.cxf.Logger file in my CXF directory.
Any idea how can I achieve logging.
November 12th, 2008 at 19:10That is because you are supposed to supply that file yourself, instead of relying on the default.
Create the META-INF/cxf/org.apache.cxf.Logger file somewhere on your classpath. If you are building a war, for instance, it should end up in WEB-INF/classes/META-INF/cxf/org.apache.cxf.Logger (or inside a jar in WEB-INF/lib).
November 12th, 2008 at 20:51