From a48897a24136524a58b84a6c36b19f0bbd6a433f Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Tue, 10 Dec 2024 16:25:57 +0100 Subject: [PATCH] Log provider setup failure at info level without stacktrace Closes gh-33979 (cherry picked from commit 3e3ca7402012d4ad893958f7639579b4b3c69373) --- .../beanvalidation/OptionalValidatorFactoryBean.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/spring-context/src/main/java/org/springframework/validation/beanvalidation/OptionalValidatorFactoryBean.java b/spring-context/src/main/java/org/springframework/validation/beanvalidation/OptionalValidatorFactoryBean.java index a2991e556333..b1097f213c8f 100644 --- a/spring-context/src/main/java/org/springframework/validation/beanvalidation/OptionalValidatorFactoryBean.java +++ b/spring-context/src/main/java/org/springframework/validation/beanvalidation/OptionalValidatorFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,6 +17,7 @@ package org.springframework.validation.beanvalidation; import jakarta.validation.ValidationException; +import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** @@ -39,7 +40,13 @@ public void afterPropertiesSet() { super.afterPropertiesSet(); } catch (ValidationException ex) { - LogFactory.getLog(getClass()).debug("Failed to set up a Bean Validation provider", ex); + Log logger = LogFactory.getLog(getClass()); + if (logger.isDebugEnabled()) { + logger.debug("Failed to set up a Bean Validation provider", ex); + } + else if (logger.isInfoEnabled()) { + logger.info("Failed to set up a Bean Validation provider: " + ex); + } } }