When customising the RequestLoggingFilter a developer cannot get the default filters. This makes it harder to replace one of the filters with an own implementation. There should be an additional static function to retrieve the filters, e.g.:
public static Filter[] getDefaultFilters() {
return new Filter[] {
new AddVcapEnvironmentToLogContextFilter(),
new AddHttpHeadersToLogContextFilter(),
new CorrelationIdFilter(),
new DynamicLogLevelFilter(),
new GenerateRequestLogFilter()
};
}
public RequestLoggingFilter() {
super(getDefaultFilters());
}
A custom subclass of RequestLoggingFilter could use this function like this to substitute the DynamicLogLevelFilter for example:
public CustomRequestLoggingFilter() {
super(Stream.of(getDefaultFilters())
.map(f -> f instanceof DynamicLogLevelFilter ? new CustomDynamicLogLevelFilter() : f)
.toArray(Filter[]::new)
);
}
When customising the RequestLoggingFilter a developer cannot get the default filters. This makes it harder to replace one of the filters with an own implementation. There should be an additional static function to retrieve the filters, e.g.:
A custom subclass of RequestLoggingFilter could use this function like this to substitute the DynamicLogLevelFilter for example: