如何让Spring WebServices记录所有SOAP请求? [英] How can I make Spring WebServices log all SOAP requests?
问题描述
我需要记录在 CommonLogFormat
中的所有SOAP请求(参见 http://en.wikipedia.org/wiki/Common_Log_Format ),加上持续时间(处理请求所需的时间)。
I need all SOAP requests logged in the CommonLogFormat
(see http://en.wikipedia.org/wiki/Common_Log_Format), plus the duration (the amount of time it takes to process the request).
最好的方法是什么?看起来可以为Spring WebServices配置log4j,但是它会记录我感兴趣的所有值吗?
http:// pijava.wordpress.com/2009/12/04/spring-webservice-soap-requestresponse-logging-with-log4j/
What's the best way to do this? It looks like it's possible to configure log4j for Spring WebServices but will it log all the values I'm interested in? http://pijava.wordpress.com/2009/12/04/spring-webservice-soap-requestresponse-logging-with-log4j/
编辑:我们是实际上使用 SLF4J
,而不是 Log4j
。此外,看起来可以通过配置PayloadLoggingInterceptor来实现这一点:$ b $ b http://static.springsource.org/spring-ws/site/reference/html/server.html#server-endpoint-interceptor
We're actually using SLF4J
, not Log4j
. Also, it looks like it's possible to do this by configuring the PayloadLoggingInterceptor:
http://static.springsource.org/spring-ws/site/reference/html/server.html#server-endpoint-interceptor
但我不确定日志消息的去向。我向拦截器添加了拦截器,我没有看到任何日志消息。
But I am not sure where the log messages will go. I added that interceptor to our interceptors and I don't see any log messages.
推荐答案
对于 Spring Boot 项目,在 application.properties中添加以下内容
为我工作:
For Spring Boot project adding below in application.properties
worked for me:
logging.level.org.springframework.web=DEBUG
logging.level.org.springframework.ws.client.MessageTracing.sent=DEBUG
logging.level.org.springframework.ws.server.MessageTracing.sent=DEBUG
logging.level.org.springframework.ws.client.MessageTracing.received=TRACE
logging.level.org.springframework.ws.server.MessageTracing.received=TRACE
这篇关于如何让Spring WebServices记录所有SOAP请求?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!