24
24
import com .sap .hcp .cf .logging .common .request .HttpHeader ;
25
25
import com .sap .hcp .cf .logging .common .request .HttpHeaders ;
26
26
import com .sap .hcp .cf .logging .common .request .RequestRecord ;
27
+ import com .sap .hcp .cf .logging .servlet .dynlog .DynLogConfiguration ;
27
28
import com .sap .hcp .cf .logging .servlet .dynlog .DynLogEnvironment ;
28
29
import com .sap .hcp .cf .logging .servlet .dynlog .DynamicLogLevelProcessor ;
29
30
49
50
* implementations of {@link DynLogEnvironment} and
50
51
* {@link DynamicLogLevelProcessor}. For integration provide a subclass of
51
52
* {@link RequestLoggingFilter} and overwrite
52
- * {@link RequestLoggingFilter#getDynLogEnvironment ()} and
53
+ * {@link RequestLoggingFilter#getDynLogConfiguration ()} and
53
54
* {@link RequestLoggingFilter#getDynLogLevelProcessor()}.
54
55
* </p>
55
56
* <p>
@@ -70,7 +71,7 @@ public class RequestLoggingFilter implements Filter {
70
71
71
72
private boolean wrapResponse = true ;
72
73
private boolean wrapRequest = true ;
73
- private ConcurrentInitializer <DynLogEnvironment > dynLogEnvironment ;
74
+ private ConcurrentInitializer <DynLogConfiguration > dynLogEnvironment ;
74
75
private ConcurrentInitializer <DynamicLogLevelProcessor > dynamicLogLevelProcessor ;
75
76
private RequestRecordFactory requestRecordFactory ;
76
77
@@ -88,43 +89,43 @@ public RequestLoggingFilter(RequestRecordFactory requestRecordFactory) {
88
89
this (requestRecordFactory , createDefaultDynLogEnvironment ());
89
90
}
90
91
91
- private static ConcurrentInitializer <DynLogEnvironment > createDefaultDynLogEnvironment () {
92
+ private static ConcurrentInitializer <DynLogConfiguration > createDefaultDynLogEnvironment () {
92
93
DynLogEnvironment environment = new DynLogEnvironment ();
93
94
return () -> environment ;
94
95
}
95
96
96
- public RequestLoggingFilter (ConcurrentInitializer <DynLogEnvironment > dynLogEnvironment ) {
97
+ public RequestLoggingFilter (ConcurrentInitializer <DynLogConfiguration > dynLogEnvironment ) {
97
98
this (createDefaultRequestRecordFactory (), dynLogEnvironment );
98
99
}
99
100
100
101
public RequestLoggingFilter (RequestRecordFactory requestRecordFactory ,
101
- ConcurrentInitializer <DynLogEnvironment > dynLogEnvironment ) {
102
+ ConcurrentInitializer <DynLogConfiguration > dynLogEnvironment ) {
102
103
this .requestRecordFactory = requestRecordFactory ;
103
104
this .dynLogEnvironment = dynLogEnvironment ;
104
105
this .dynamicLogLevelProcessor = new LazyInitializer <DynamicLogLevelProcessor >() {
105
106
106
107
@ Override
107
108
protected DynamicLogLevelProcessor initialize () throws ConcurrentException {
108
- return getDynLogEnvironment ().map (DynLogEnvironment ::getRsaPublicKey ).map (DynamicLogLevelProcessor ::new )
109
+ return getDynLogConfiguration ().map (DynLogConfiguration ::getRsaPublicKey ).map (DynamicLogLevelProcessor ::new )
109
110
.get ();
110
111
}
111
112
};
112
113
}
113
114
114
- public RequestLoggingFilter (ConcurrentInitializer <DynLogEnvironment > dynLogEnvironment ,
115
+ public RequestLoggingFilter (ConcurrentInitializer <DynLogConfiguration > dynLogEnvironment ,
115
116
ConcurrentInitializer <DynamicLogLevelProcessor > dynamicLogLevelProcessor ) {
116
117
this (createDefaultRequestRecordFactory (), dynLogEnvironment , dynamicLogLevelProcessor );
117
118
}
118
119
119
120
public RequestLoggingFilter (RequestRecordFactory requestRecordFactory ,
120
- ConcurrentInitializer <DynLogEnvironment > dynLogEnvironment ,
121
+ ConcurrentInitializer <DynLogConfiguration > dynLogEnvironment ,
121
122
ConcurrentInitializer <DynamicLogLevelProcessor > dynamicLogLevelProcessor ) {
122
123
this .requestRecordFactory = requestRecordFactory ;
123
124
this .dynLogEnvironment = dynLogEnvironment ;
124
125
this .dynamicLogLevelProcessor = dynamicLogLevelProcessor ;
125
126
}
126
127
127
- protected Optional <DynLogEnvironment > getDynLogEnvironment () {
128
+ protected Optional <DynLogConfiguration > getDynLogConfiguration () {
128
129
try {
129
130
return Optional .of (dynLogEnvironment .get ());
130
131
} catch (ConcurrentException cause ) {
@@ -135,7 +136,7 @@ protected Optional<DynLogEnvironment> getDynLogEnvironment() {
135
136
136
137
protected Optional <DynamicLogLevelProcessor > getDynLogLevelProcessor () {
137
138
try {
138
- if (getDynLogEnvironment ().map (DynLogEnvironment ::getRsaPublicKey ).isPresent ()) {
139
+ if (getDynLogConfiguration ().map (DynLogConfiguration ::getRsaPublicKey ).isPresent ()) {
139
140
return Optional .of (dynamicLogLevelProcessor .get ());
140
141
}
141
142
} catch (ConcurrentException cause ) {
@@ -235,7 +236,7 @@ private void doFilterRequest(HttpServletRequest httpRequest, HttpServletResponse
235
236
236
237
private void activateDynamicLogLevels (HttpServletRequest httpRequest ) {
237
238
getDynLogLevelProcessor ().ifPresent (processor -> {
238
- getDynLogEnvironment ().map (env -> env .getDynLogHeaderValue (httpRequest )).ifPresent (
239
+ getDynLogConfiguration ().map (env -> env .getDynLogHeaderValue (httpRequest )).ifPresent (
239
240
processor ::copyDynamicLogLevelToMDC );
240
241
});
241
242
}
0 commit comments