【问题标题】:Enable logging in Apache CXF generated client在 Apache CXF 生成的客户端中启用日志记录
【发布时间】:2014-04-25 23:31:00
【问题描述】:

我按照 CXF 网站上的说明启用了 SOAP 请求的日志记录,但在我的日志中看不到任何日志记录。 我有log4j,所以我将-Dorg.apache.cxf.Logger=org.apache.cxf.common.logging.Log4jLogger 添加到Tomcat jvm args,然后我创建了cxf.xml 并放入类路径。我还将记录器添加到 log4j 配置中。 没有任何记录。 可能是什么问题?

cxf.xml:
<beans xmlns="http://www.springframework.org/schema/beans"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:cxf="http://cxf.apache.org/core"
  xsi:schemaLocation="
  http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
  http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">

<cxf:bus>
    <cxf:features>
        <cxf:logging/>
    </cxf:features>
</cxf:bus>
</beans>

【问题讨论】:

    标签: apache logging cxf


    【解决方案1】:

    我使用LoggingInInterceptor/LoggingOutInterceptor 并不确定您的总线配置,但您应该确保还在您的 log4j 配置中添加了正确的记录器(具有正确的名称)。

    在 Apache CXF - 2.5 Migration Guido 你会找到有用的信息

    日志拦截器现在使用特定于服务的日志 类别/记录器,而不仅仅是 LoggingInInterceptor/LoggingOutInterceptor。记录器的名称 使用的是 org.apache.cxf.services.ServiceName.PortName.PortTypeName。这允许 用户配置特定的每个服务过滤器和格式化程序 他们的日志记录配置。

    我写了一篇关于使用 Apache CXF 进行日志记录的 blog post,它提供了在我的应用程序中启用请求/响应日志记录所需的所有信息。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-07-07
      • 1970-01-01
      • 1970-01-01
      • 2014-03-10
      • 1970-01-01
      • 2014-01-09
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多