Uploaded image for project: 'ServiceMix 4'
  1. ServiceMix 4
  2. SMX4-1002

Use SLF4J instead of Java standard logging for CXF in SMX

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Trivial
    • Resolution: Fixed
    • Affects Version/s: 4.3.0
    • Fix Version/s: 4.4.0
    • Component/s: Bundles
    • Labels:
      None
    • Environment:

      ServiceMix 4.3

      Description

      CXF uses by default the default Java logging framework (java.util.logging).
      This framework does not support MDC (Mapped Diagnostic Context).
      If the MDCSiftingAppender is used to have separate files for each route,
      all CXF logs end up in the default file.

      Solution : add the following line :
      org.apache.cxf.Logger=org.apache.cxf.common.logging.Slf4jLogger
      in the file
      $SERVICEMIX_HOME/etc/system.properties

      I propose to make it the default value in the ServiceMix distribution, if nobody sees any down-sides.
      http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/assemblies/shared/src/main/resources/etc/system.properties

      Thanks.

        Activity

        Hide
        ffang Freeman Fang added a comment -

        sounds good to me to set SLF4J as default log for CXF, as other SMX part already switch to use SLF4J now.

        Show
        ffang Freeman Fang added a comment - sounds good to me to set SLF4J as default log for CXF, as other SMX part already switch to use SLF4J now.
        Hide
        metatech metatech added a comment -

        Tip: using one log file per service can easily be enabled with the following snippet in Spring XML :

        	<bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
        		<property name="targetClass">
        			<value>org.slf4j.MDC</value>
        		</property>
        		<property name="targetMethod">
        		 	<value>put</value>
        		</property>
        		<property name="arguments">
        			<list>
        				<value>service</value>
        				<value>nameOfTheFileToUseForLog</value>
        			</list>
        		</property>
        	</bean>
        

        and configure in org.ops4j.pax.logging.cfg :

        log4j.appender.sift.key=service
        
        Show
        metatech metatech added a comment - Tip: using one log file per service can easily be enabled with the following snippet in Spring XML : <bean class= "org.springframework.beans.factory.config.MethodInvokingFactoryBean" > <property name= "targetClass" > <value> org.slf4j.MDC </value> </property> <property name= "targetMethod" > <value> put </value> </property> <property name= "arguments" > <list> <value> service </value> <value> nameOfTheFileToUseForLog </value> </list> </property> </bean> and configure in org.ops4j.pax.logging.cfg : log4j.appender.sift.key=service

          People

          • Assignee:
            ffang Freeman Fang
            Reporter:
            metatech metatech
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 0.5h
              0.5h
              Remaining:
              Remaining Estimate - 0.5h
              0.5h
              Logged:
              Time Spent - Not Specified
              Not Specified

                Development