2016-04-22 58 views
0

我正嘗試在tomcat日誌文件夾中的debug.log文件中寫入。使用logback/slf4j進行記錄。 已添加:類路徑中的org.apache.cxf.Logger:/ META-INF/cxf /。無法登錄到CXF RS Web服務的文件

更新休息-context.xml中:

<cxf:bus> 
     <cxf:inInterceptors> 
     <ref bean="loggingInInterceptor" /> 
    </cxf:inInterceptors> 
    <cxf:inFaultInterceptors> 
     <ref bean="loggingInInterceptor" /> 
    </cxf:inFaultInterceptors> 
    <cxf:outInterceptors> 
     <ref bean="logOutInterceptor" /> 
    </cxf:outInterceptors> 
    <cxf:outFaultInterceptors> 
     <ref bean="logOutInterceptor" /> 
    </cxf:outFaultInterceptors> 

</cxf:bus> 

這裏是logback.xml:

<property name="DEV_HOME" value="D:/apache-tomcat-7.0.62/logs" /> 

<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> 
    <layout class="ch.qos.logback.classic.PatternLayout"> 
     <Pattern> 
      %d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n 
     </Pattern> 
    </layout> 
</appender> 

<appender name="FILE-AUDIT" 
    class="ch.qos.logback.core.rolling.RollingFileAppender"> 
    <file>${CATLINA_HOME}/logs/debug.log</file> 
    <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> 
     <Pattern> 
      %d{yyyy-MM-dd HH:mm:ss} - %msg%n 
     </Pattern> 
    </encoder> 

    <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> 
     <!-- rollover daily --> 
     <fileNamePattern>${DEV_HOME}/archived/debug.%d{yyyy-MM-dd}.%i.log 
        </fileNamePattern> 
     <timeBasedFileNamingAndTriggeringPolicy 
      class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> 
      <maxFileSize>10MB</maxFileSize> 
     </timeBasedFileNamingAndTriggeringPolicy> 
    </rollingPolicy> 

</appender> 

<appender name="FILE-ERROR" 
    class="ch.qos.logback.core.rolling.RollingFileAppender"> 
    <file>${DEV_HOME}/error.log</file> 
    <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> 
     <Pattern> 
      %d{yyyy-MM-dd HH:mm:ss} - %msg%n 
     </Pattern> 
    </encoder> 

    <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> 
     <!-- rollover daily --> 
     <fileNamePattern>${DEV_HOME}/archived/error.%d{yyyy-MM-dd}.%i.log 
        </fileNamePattern> 
     <timeBasedFileNamingAndTriggeringPolicy 
      class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> 
      <maxFileSize>10MB</maxFileSize> 
     </timeBasedFileNamingAndTriggeringPolicy> 
    </rollingPolicy> 

</appender> 

<!-- Send logs to both console and file audit --> 
<logger name="com.ff" level="debug" 
    additivity="false"> 
    <appender-ref ref="FILE-AUDIT" /> 
    <appender-ref ref="STDOUT" /> 
</logger> 

<root level="error"> 
    <appender-ref ref="FILE-ERROR" /> 
</root> 

此外,我想要做的伐木我的DAO文件和服務方法不僅包括入站和出站消息。 請指導我在哪裏做錯了。 感謝

+0

我可以看到入站和出站loggs控制檯,但沒有在文件中。 –

+0

根據我的理解,它不加載logback.xml,因爲我從classpath中刪除了文件,它仍然在控制檯中生成入站和出站。 –

回答