Skip to content

Commit 9a43d2e

Browse files
committed
Revised log levels: less WARN and INFO, fine-tuned DEBUG vs TRACE
Issue: SPR-16946
1 parent a410d90 commit 9a43d2e

File tree

99 files changed

+461
-486
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+461
-486
lines changed

spring-aop/src/main/java/org/springframework/aop/framework/CglibAopProxy.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,16 +259,16 @@ private void doValidateClass(Class<?> proxySuperClass, @Nullable ClassLoader pro
259259
if (!Modifier.isStatic(mod) && !Modifier.isPrivate(mod)) {
260260
if (Modifier.isFinal(mod)) {
261261
if (implementsInterface(method, ifcs)) {
262-
logger.warn("Unable to proxy interface-implementing method [" + method + "] because " +
262+
logger.info("Unable to proxy interface-implementing method [" + method + "] because " +
263263
"it is marked as final: Consider using interface-based JDK proxies instead!");
264264
}
265-
logger.info("Final method [" + method + "] cannot get proxied via CGLIB: " +
265+
logger.debug("Final method [" + method + "] cannot get proxied via CGLIB: " +
266266
"Calls to this method will NOT be routed to the target instance and " +
267267
"might lead to NPEs against uninitialized fields in the proxy instance.");
268268
}
269269
else if (!Modifier.isPublic(mod) && !Modifier.isProtected(mod) &&
270270
proxyClassLoader != null && proxySuperClass.getClassLoader() != proxyClassLoader) {
271-
logger.info("Method [" + method + "] is package-visible across different ClassLoaders " +
271+
logger.debug("Method [" + method + "] is package-visible across different ClassLoaders " +
272272
"and cannot get proxied via CGLIB: Declare this method as public or protected " +
273273
"if you need to support invocations through the proxy.");
274274
}

spring-aop/src/main/java/org/springframework/aop/framework/ProxyFactoryBean.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ public Object getObject() throws BeansException {
255255
}
256256
else {
257257
if (this.targetName == null) {
258-
logger.warn("Using non-singleton proxies with singleton targets is often undesirable. " +
258+
logger.info("Using non-singleton proxies with singleton targets is often undesirable. " +
259259
"Enable prototype proxies by setting the 'targetName' property.");
260260
}
261261
return newPrototypeInstance();

spring-aop/src/main/java/org/springframework/aop/interceptor/AsyncExecutionAspectSupport.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ protected void handleError(Throwable ex, Method method, Object... params) throws
314314
this.exceptionHandler.obtain().handleUncaughtException(ex, method, params);
315315
}
316316
catch (Throwable ex2) {
317-
logger.error("Exception handler for async method '" + method.toGenericString() +
317+
logger.warn("Exception handler for async method '" + method.toGenericString() +
318318
"' threw unexpected exception itself", ex2);
319319
}
320320
}

spring-aop/src/main/java/org/springframework/aop/interceptor/SimpleAsyncUncaughtExceptionHandler.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
* A default {@link AsyncUncaughtExceptionHandler} that simply logs the exception.
2626
*
2727
* @author Stephane Nicoll
28+
* @author Juergen Hoeller
2829
* @since 4.1
2930
*/
3031
public class SimpleAsyncUncaughtExceptionHandler implements AsyncUncaughtExceptionHandler {
@@ -35,7 +36,7 @@ public class SimpleAsyncUncaughtExceptionHandler implements AsyncUncaughtExcepti
3536
@Override
3637
public void handleUncaughtException(Throwable ex, Method method, Object... params) {
3738
if (logger.isErrorEnabled()) {
38-
logger.error("Unexpected error occurred invoking async method: " + method, ex);
39+
logger.error("Unexpected exception occurred invoking async method: " + method, ex);
3940
}
4041
}
4142

spring-aop/src/main/java/org/springframework/aop/target/AbstractPrototypeBasedTargetSource.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ else if (target instanceof DisposableBean) {
8585
((DisposableBean) target).destroy();
8686
}
8787
catch (Throwable ex) {
88-
logger.error("Couldn't invoke destroy method of bean with name '" + getTargetBeanName() + "'", ex);
88+
logger.warn("Destroy method on bean with name '" + getTargetBeanName() + "' threw an exception", ex);
8989
}
9090
}
9191
}

spring-beans/src/main/java/org/springframework/beans/BeanUtils.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -497,8 +497,8 @@ public static PropertyEditor findEditorByConvention(@Nullable Class<?> targetTyp
497497
try {
498498
Class<?> editorClass = cl.loadClass(editorName);
499499
if (!PropertyEditor.class.isAssignableFrom(editorClass)) {
500-
if (logger.isWarnEnabled()) {
501-
logger.warn("Editor class [" + editorName +
500+
if (logger.isInfoEnabled()) {
501+
logger.info("Editor class [" + editorName +
502502
"] does not implement [java.beans.PropertyEditor] interface");
503503
}
504504
unknownEditorTypes.add(targetType);

spring-beans/src/main/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ public AutowiredAnnotationBeanPostProcessor() {
150150
try {
151151
this.autowiredAnnotationTypes.add((Class<? extends Annotation>)
152152
ClassUtils.forName("javax.inject.Inject", AutowiredAnnotationBeanPostProcessor.class.getClassLoader()));
153-
logger.info("JSR-330 'javax.inject.Inject' annotation found and supported for autowiring");
153+
logger.trace("JSR-330 'javax.inject.Inject' annotation found and supported for autowiring");
154154
}
155155
catch (ClassNotFoundException ex) {
156156
// JSR-330 API not available - simply skip.

spring-beans/src/main/java/org/springframework/beans/factory/annotation/InitDestroyAnnotationBeanPostProcessor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ public void postProcessBeforeDestruction(Object bean, String beanName) throws Be
156156
metadata.invokeDestroyMethods(bean, beanName);
157157
}
158158
catch (InvocationTargetException ex) {
159-
String msg = "Invocation of destroy method failed on bean with name '" + beanName + "'";
159+
String msg = "Destroy method on bean with name '" + beanName + "' threw an exception";
160160
if (logger.isDebugEnabled()) {
161161
logger.warn(msg, ex.getTargetException());
162162
}
@@ -165,7 +165,7 @@ public void postProcessBeforeDestruction(Object bean, String beanName) throws Be
165165
}
166166
}
167167
catch (Throwable ex) {
168-
logger.error("Failed to invoke destroy method on bean with name '" + beanName + "'", ex);
168+
logger.warn("Failed to invoke destroy method on bean with name '" + beanName + "'", ex);
169169
}
170170
}
171171

spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanFactory.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -899,13 +899,13 @@ public void registerScope(String scopeName, Scope scope) {
899899
}
900900
Scope previous = this.scopes.put(scopeName, scope);
901901
if (previous != null && previous != scope) {
902-
if (logger.isInfoEnabled()) {
903-
logger.info("Replacing scope '" + scopeName + "' from [" + previous + "] to [" + scope + "]");
902+
if (logger.isDebugEnabled()) {
903+
logger.debug("Replacing scope '" + scopeName + "' from [" + previous + "] to [" + scope + "]");
904904
}
905905
}
906906
else {
907-
if (logger.isDebugEnabled()) {
908-
logger.debug("Registering scope '" + scopeName + "' with implementation [" + scope + "]");
907+
if (logger.isTraceEnabled()) {
908+
logger.trace("Registering scope '" + scopeName + "' with implementation [" + scope + "]");
909909
}
910910
}
911911
}
@@ -1526,8 +1526,8 @@ else if (mbd.isLazyInit()) {
15261526
}
15271527
}
15281528
else {
1529-
if (logger.isWarnEnabled()) {
1530-
logger.warn("Bean creation exception on non-lazy FactoryBean type check: " + ex);
1529+
if (logger.isInfoEnabled()) {
1530+
logger.info("Bean creation exception on non-lazy FactoryBean type check: " + ex);
15311531
}
15321532
}
15331533
onSuppressedException(ex);

spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -810,22 +810,22 @@ public void registerBeanDefinition(String beanName, BeanDefinition beanDefinitio
810810
}
811811
else if (existingDefinition.getRole() < beanDefinition.getRole()) {
812812
// e.g. was ROLE_APPLICATION, now overriding with ROLE_SUPPORT or ROLE_INFRASTRUCTURE
813-
if (logger.isWarnEnabled()) {
814-
logger.warn("Overriding user-defined bean definition for bean '" + beanName +
813+
if (logger.isInfoEnabled()) {
814+
logger.info("Overriding user-defined bean definition for bean '" + beanName +
815815
"' with a framework-generated bean definition: replacing [" +
816816
existingDefinition + "] with [" + beanDefinition + "]");
817817
}
818818
}
819819
else if (!beanDefinition.equals(existingDefinition)) {
820-
if (logger.isInfoEnabled()) {
821-
logger.info("Overriding bean definition for bean '" + beanName +
820+
if (logger.isDebugEnabled()) {
821+
logger.debug("Overriding bean definition for bean '" + beanName +
822822
"' with a different definition: replacing [" + existingDefinition +
823823
"] with [" + beanDefinition + "]");
824824
}
825825
}
826826
else {
827-
if (logger.isDebugEnabled()) {
828-
logger.debug("Overriding bean definition for bean '" + beanName +
827+
if (logger.isTraceEnabled()) {
828+
logger.trace("Overriding bean definition for bean '" + beanName +
829829
"' with an equivalent definition: replacing [" + existingDefinition +
830830
"] with [" + beanDefinition + "]");
831831
}

0 commit comments

Comments
 (0)