Skip to content

Commit e518bdc

Browse files
committed
Adding the REST logging filter for Save and Restore
1 parent 2c5cae3 commit e518bdc

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package org.phoebus.service.saveandrestore.web.controllers;
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 RequestLoggingFilterConfig {
9+
10+
@Bean
11+
public CommonsRequestLoggingFilter logFilter() {
12+
CommonsRequestLoggingFilter filter
13+
= new CommonsRequestLoggingFilter();
14+
filter.setIncludeQueryString(true);
15+
filter.setIncludePayload(true);
16+
filter.setMaxPayloadLength(10000);
17+
filter.setIncludeHeaders(false);
18+
filter.setAfterMessagePrefix("REQUEST DATA : ");
19+
return filter;
20+
}
21+
}

services/save-and-restore/src/main/resources/application.properties

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,8 @@ spring.datasource.type=com.zaxxer.hikari.HikariDataSource
33
spring.datasource.hikari.maximumPoolSize=10
44
spring.datasource.hikari.connectionTestQuery=SELECT 1
55
app.version=@project.version@
6-
6+
app.name=@project.name@
7+
8+
############################## REST Logging ###############################
9+
# DEBUG level will log all requests and responses to and from the REST end points
10+
logging.level.org.springframework.web.filter.CommonsRequestLoggingFilter=INFO

0 commit comments

Comments
 (0)