Skip to content

Commit 60ba957

Browse files
committed
Adding the REST logging filter for alarm logging
1 parent e518bdc commit 60ba957

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package org.phoebus.alarm.logging.rest;
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/alarm-logger/src/main/resources/application.properties

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,8 @@ use_dated_index_names=true
3434
date_span_units=M
3535

3636
# Size of the thread pool for message and command loggers. Two threads per topic/configuration are required
37-
thread_pool_size=4
37+
thread_pool_size=4
38+
39+
############################## REST Logging ###############################
40+
# DEBUG level will log all requests and responses to and from the REST end points
41+
logging.level.org.springframework.web.filter.CommonsRequestLoggingFilter=INFO

0 commit comments

Comments
 (0)