Browse Source

Log provider setup failure at info level without stacktrace

Closes gh-33979

(cherry picked from commit 3e3ca74020)
6.1.x
Juergen Hoeller 1 year ago
parent
commit
a48897a241
  1. 11
      spring-context/src/main/java/org/springframework/validation/beanvalidation/OptionalValidatorFactoryBean.java

11
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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -17,6 +17,7 @@
package org.springframework.validation.beanvalidation; package org.springframework.validation.beanvalidation;
import jakarta.validation.ValidationException; import jakarta.validation.ValidationException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
/** /**
@ -39,7 +40,13 @@ public class OptionalValidatorFactoryBean extends LocalValidatorFactoryBean {
super.afterPropertiesSet(); super.afterPropertiesSet();
} }
catch (ValidationException ex) { 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);
}
} }
} }

Loading…
Cancel
Save