I looked up all messages but did not find a clear answer for that question.
How can I configure logging to log CXF inbound and outbound restful messages ?
I have the following setup.
File org.apache.cxf.Logger with
org.apache.cxf.common.logging.Log4jLogger
applicationContext.xml has the following (it sounds silly, but it is the only place for interceptors I could get messages output)
<bean id="abstractLoggingInterceptor" abstract="true"> <property name="prettyLogging" value="true"/> </bean> <bean id="loggingInInterceptor" class="org.apache.cxf.interceptor.LoggingInInterceptor" parent="abstractLoggingInterceptor"/> <bean id="loggingOutInterceptor" class="org.apache.cxf.interceptor.LoggingOutInterceptor" parent="abstractLoggingInterceptor"/> <cxf:bus> <cxf:inInterceptors> <ref bean="loggingInInterceptor"/> </cxf:inInterceptors> <cxf:outInterceptors> <ref bean="loggingOutInterceptor"/> </cxf:outInterceptors> <cxf:outFaultInterceptors> <ref bean="loggingOutInterceptor"/> </cxf:outFaultInterceptors> <cxf:inFaultInterceptors> <ref bean="loggingInInterceptor"/> </cxf:inFaultInterceptors> </cxf:bus>
I tried to follow these instructions with slf4j and with log4j, but the the only output I get to the file is application log messages. I can see inbound and outbound messages on my console.
Can I get something similar to logback.xml work for me, so I separate app logs and message logs. Example: http://www.wolfe.id.au/2011/05/20/apache-cxf-logging/
Thanks.
EDIT 1: I removed org.apache.cxf.common.logging.Log4jLogger from my classpath, and placed the following to my log4j.xml. It logging to the file and to console when the level of logging is equal to INFO.
<appender name="RSLOGFILE" class="org.apache.log4j.RollingFileAppender">
<param name="file" value="${project.basedir}/logs/cxf_inout_messages.log"/>
<param name="MaxFileSize" value="100KB"/>
<!-- Keep one backup file -->
<param name="MaxBackupIndex" value="1"/>
<layout class="org.apache.log4j.PatternLayout">
<!-- Print the date in ISO 8601 format -->
<param name="ConversionPattern" value="%d [%t] %-5p %c - %m%n"/>
</layout>
</appender>
<logger name="org.apache.cxf">
<level value="ERROR"/>
<appender-ref ref="RSLOGFILE"/>
</logger>