Skip to content

Commit a48897a

Browse files
committed
Log provider setup failure at info level without stacktrace
Closes gh-33979 (cherry picked from commit 3e3ca74)
1 parent 7ffa12f commit a48897a

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

spring-context/src/main/java/org/springframework/validation/beanvalidation/OptionalValidatorFactoryBean.java

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2013 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -17,6 +17,7 @@
1717
package org.springframework.validation.beanvalidation;
1818

1919
import jakarta.validation.ValidationException;
20+
import org.apache.commons.logging.Log;
2021
import org.apache.commons.logging.LogFactory;
2122

2223
/**
@@ -39,7 +40,13 @@ public void afterPropertiesSet() {
3940
super.afterPropertiesSet();
4041
}
4142
catch (ValidationException ex) {
42-
LogFactory.getLog(getClass()).debug("Failed to set up a Bean Validation provider", ex);
43+
Log logger = LogFactory.getLog(getClass());
44+
if (logger.isDebugEnabled()) {
45+
logger.debug("Failed to set up a Bean Validation provider", ex);
46+
}
47+
else if (logger.isInfoEnabled()) {
48+
logger.info("Failed to set up a Bean Validation provider: " + ex);
49+
}
4350
}
4451
}
4552

0 commit comments

Comments
 (0)