1

我试图将消息记录到日志文件中,但我的代码似乎不起作用

我做错了什么或者我该如何继续?

    <pattern:web-service-proxy name="serv" inboundAddress="${serverName}/services/Logradouros/PontoReferenciaServico" outboundAddress="${targetServer}/servicos/v2/PontoReferenciaServico.svc" wsdlFile="PontoReferenciaServico.wsdl">
</pattern:web-service-proxy>



<flow name="service" doc:name="service">

    <logger message="#[message.inboundProperties.Host] #[message.inboundProperties.version] #[message.inboundProperties.http.method] #message.inboundProperties.http.request] #[message.inboundProperties.MULE_REMOTE_CLIENT_ADDRESS] #[message.inboundProperties.User-Agent]" category="mule.http.accesslog" level="ERROR" doc:name="Logger">
    </logger>  
</flow>

该消息未显示在日志文件中...

4

1 回答 1

1

唉,没有直接的方法来记录流经模式的消息。一种解决方法是创建一个 NOOP 转换器来执行所需的日志记录并在模式中引用此转换器:

<scripting:transformer name="noopLoggingTransformer">
    <scripting:script engine="groovy">
        log.info "${message.getInboundProperty('Host')} ${message.getInboundProperty('version')} ..."
        message
    </scripting:script>
</scripting:transformer>

<pattern:web-service-proxy name="serv"
    transformer-refs="noopLoggingTransformer"
    inboundAddress="${serverName}/services/Logradouros/PontoReferenciaServico"
    outboundAddress="${targetServer}/servicos/v2/PontoReferenciaServico.svc"
    wsdlFile="PontoReferenciaServico.wsdl" />
于 2013-10-04T19:31:20.107 回答