diff --git a/solr/core/src/java/org/apache/solr/servlet/ServletUtils.java b/solr/core/src/java/org/apache/solr/servlet/ServletUtils.java index 28b7811ed84..dc31ea7449e 100644 --- a/solr/core/src/java/org/apache/solr/servlet/ServletUtils.java +++ b/solr/core/src/java/org/apache/solr/servlet/ServletUtils.java @@ -204,10 +204,10 @@ static void rateLimitRequest( Runnable limitedExecution) throws ServletException, IOException { try (RequestRateLimiter.SlotReservation accepted = rateLimitManager.handleRequest(request)) { - if (log.isInfoEnabled()) { - log.info("rate limit request {}", request.getRequestURI()); - } if (accepted == null) { + if (log.isInfoEnabled()) { + log.info("rate limit request {}", request.getRequestURI()); + } response.sendError(ErrorCode.TOO_MANY_REQUESTS.code, RateLimitManager.ERROR_MESSAGE); return; }