@@ -70,14 +70,12 @@ Mono<ServerResponse> finalizeResult(final Mono<ServerResponse> mono,
70
70
private Mono <ServerResponse > handleErrorMetrics (final Throwable error , final ServerRequest request ) {
71
71
if (error instanceof RepositoryException ) {
72
72
recordMetric (MeasurementTag .ERROR_DB );
73
- } else if (error instanceof ResourceNotFoundException ) {
73
+ } else if (error instanceof ResourceNotFoundException || error instanceof BadRequestException ) {
74
74
conditionalLogger .info (
75
75
error .getMessage ()
76
76
+ ". Refererring URLs: " + request .headers ().header (HttpHeaders .REFERER )
77
77
+ ". Request URI: " + request .uri (),
78
78
samplingRate );
79
- } else if (error instanceof BadRequestException ) {
80
- log .error (error .getMessage ());
81
79
} else if (error instanceof TimeoutException ) {
82
80
metricsRecorder .markMeterForTag (this .metricTagPrefix , MeasurementTag .ERROR_TIMED_OUT );
83
81
} else if (error instanceof DataBufferLimitException ) {
@@ -86,8 +84,9 @@ private Mono<ServerResponse> handleErrorMetrics(final Throwable error, final Ser
86
84
"Request length: `" + contentLength + "` exceeds maximum size limit" ,
87
85
samplingRate );
88
86
} else {
89
- log .error ("Error occurred while processing the request: '{}', cause: '{}'" ,
90
- ExceptionUtils .getMessage (error ), ExceptionUtils .getMessage (error ));
87
+ conditionalLogger .error ("Error occurred while processing the request: '%s', cause: '%s'" .formatted (
88
+ ExceptionUtils .getMessage (error ), ExceptionUtils .getMessage (error )),
89
+ samplingRate );
91
90
}
92
91
93
92
return builder .error (Mono .just (error ), request )
0 commit comments