Skip to content

Commit d8d3740

Browse files
committed
Added basic request logging config
1 parent fcf813b commit d8d3740

2 files changed

Lines changed: 26 additions & 3 deletions

File tree

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package es.pedrazamiguez.onlinebookstore.config.logging;
2+
3+
import org.springframework.context.annotation.Bean;
4+
import org.springframework.context.annotation.Configuration;
5+
import org.springframework.web.filter.CommonsRequestLoggingFilter;
6+
7+
@Configuration
8+
public class RequestLoggingConfiguration {
9+
10+
@Bean
11+
public CommonsRequestLoggingFilter requestLoggingFilter() {
12+
CommonsRequestLoggingFilter loggingFilter = new CommonsRequestLoggingFilter();
13+
loggingFilter.setIncludeClientInfo(true);
14+
loggingFilter.setIncludeHeaders(true);
15+
loggingFilter.setIncludeQueryString(true);
16+
loggingFilter.setIncludePayload(true);
17+
loggingFilter.setMaxPayloadLength(10000);
18+
loggingFilter.setAfterMessagePrefix("REQUEST DATA: ");
19+
return loggingFilter;
20+
}
21+
22+
}

online-bookstore/online-bookstore-boot/src/main/resources/application-local.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@ spring:
1616
show_sql: true
1717
properties.hibernate.format_sql: true
1818

19-
logging.level:
20-
org.hibernate:
21-
type: trace
19+
logging:
20+
level:
21+
org.hibernate.type: trace
22+
org.springframework.web.filter.CommonsRequestLoggingFilter: debug
2223

2324
pricing:
2425
discount:

0 commit comments

Comments
 (0)