apache / apache/grails-core

Spring CommonsRequestLoggingFilter not log body

Open
#11,024 11 comments 5 reactions 1 assignee Claimed by @puneetbehl View on GitHub
relates-to: spring boot status: awaiting third-party
Dominant language
Groovy
Stars
2.9k
Forks
975
Avg merge
1d 22h
Merged PRs (30d)
92

Description

Hi,

I am using Spring CommonsRequestLoggingFilter for log requests and responses in my application.

I configured it

```
@Configuration
public class RequestLoggingFilterConfig {

@Bean
public CommonsRequestLoggingFilter logFilter() {

CommonsRequestLoggingFilter filter = new CommonsRequestLoggingFilter()
filter.setIncludeQueryString(true)
filter.setIncludePayload(true)
filter.setIncludeHeaders(true)
filter.setIncludeClientInfo(true)

return filter
}
}
```
body request contains

`{
"interactionId" : "6d1ed753-8169-4475-8a52-637946b35a0d"
}`

and this is the logs
`10:20:56.690 [http-nio-8094-exec-8] DEBUG - Line 47 in o.s.w.f.CommonsRequestLoggingFilter - Before request [uri=/advisor/lookup;client=0:0:0:0:0:0:0:1;headers={accept=[application/json], grant=[grant], cache-control=[no-cache], postman-token=[52a3671a-5298-4608-a0a9-d417851449f1], user-agent=[PostmanRuntime/7.1.5], host=[localhost:8094], accept-encoding=[gzip, deflate], content-length=[61], connection=[keep-alive], Content-Type=[application/json;charset=UTF-8]}]`

`10:21:11.208 [http-nio-8094-exec-8] DEBUG - Line 55 in o.s.w.f.CommonsRequestLoggingFilter - After request [uri=/advisor/lookup;client=0:0:0:0:0:0:0:1;headers={accept=[application/json], grant=[grant], cache-control=[no-cache], postman-token=[52a3671a-5298-4608-a0a9-d417851449f1], user-agent=[PostmanRuntime/7.1.5], host=[localhost:8094], accept-encoding=[gzip, deflate], content-length=[61], connection=[keep-alive], Content-Type=[application/json;charset=UTF-8]}]`

### Environment Information

- **Operating System**: Ubuntu 16.04LTS
- **Grails Version:** 3.2.0
- **JDK Version:** jdk1.8.0_31

The same configuration with Spring Boot works good.

Any suggestions?

Thanks,
Mario.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.