diff --git a/spring-aop/src/main/java/org/springframework/aop/target/AbstractPrototypeBasedTargetSource.java b/spring-aop/src/main/java/org/springframework/aop/target/AbstractPrototypeBasedTargetSource.java index 4376dcddf6..1e507559a7 100644 --- a/spring-aop/src/main/java/org/springframework/aop/target/AbstractPrototypeBasedTargetSource.java +++ b/spring-aop/src/main/java/org/springframework/aop/target/AbstractPrototypeBasedTargetSource.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2018 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. @@ -74,8 +74,8 @@ public abstract class AbstractPrototypeBasedTargetSource extends AbstractBeanFac * @param target the bean instance to destroy */ protected void destroyPrototypeInstance(Object target) { - if (this.logger.isDebugEnabled()) { - this.logger.debug("Destroying instance of bean '" + getTargetBeanName() + "'"); + if (logger.isDebugEnabled()) { + logger.debug("Destroying instance of bean '" + getTargetBeanName() + "'"); } if (getBeanFactory() instanceof ConfigurableBeanFactory) { ((ConfigurableBeanFactory) getBeanFactory()).destroyBean(getTargetBeanName(), target); diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/parsing/FailFastProblemReporter.java b/spring-beans/src/main/java/org/springframework/beans/factory/parsing/FailFastProblemReporter.java index dbafd3fddc..f62341253d 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/parsing/FailFastProblemReporter.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/parsing/FailFastProblemReporter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2018 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. @@ -78,7 +78,7 @@ public class FailFastProblemReporter implements ProblemReporter { */ @Override public void warning(Problem problem) { - this.logger.warn(problem, problem.getRootCause()); + logger.warn(problem, problem.getRootCause()); } } diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java index 066603fb44..3c8fce37e0 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java @@ -440,8 +440,8 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto throw ex; } // Probably contains a placeholder: let's ignore it for type matching purposes. - if (this.logger.isDebugEnabled()) { - this.logger.debug("Ignoring bean class loading failure for bean '" + beanName + "'", ex); + if (logger.isDebugEnabled()) { + logger.debug("Ignoring bean class loading failure for bean '" + beanName + "'", ex); } onSuppressedException(ex); } @@ -450,8 +450,8 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto throw ex; } // Probably contains a placeholder: let's ignore it for type matching purposes. - if (this.logger.isDebugEnabled()) { - this.logger.debug("Ignoring unresolvable metadata in bean definition '" + beanName + "'", ex); + if (logger.isDebugEnabled()) { + logger.debug("Ignoring unresolvable metadata in bean definition '" + beanName + "'", ex); } onSuppressedException(ex); } @@ -521,8 +521,8 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto BeanCreationException bce = (BeanCreationException) rootCause; String exBeanName = bce.getBeanName(); if (exBeanName != null && isCurrentlyInCreation(exBeanName)) { - if (this.logger.isDebugEnabled()) { - this.logger.debug("Ignoring match to currently created bean '" + exBeanName + "': " + + if (logger.isDebugEnabled()) { + logger.debug("Ignoring match to currently created bean '" + exBeanName + "': " + ex.getMessage()); } onSuppressedException(ex); @@ -680,8 +680,8 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto public BeanDefinition getBeanDefinition(String beanName) throws NoSuchBeanDefinitionException { BeanDefinition bd = this.beanDefinitionMap.get(beanName); if (bd == null) { - if (this.logger.isTraceEnabled()) { - this.logger.trace("No bean named '" + beanName + "' found in " + this); + if (logger.isTraceEnabled()) { + logger.trace("No bean named '" + beanName + "' found in " + this); } throw new NoSuchBeanDefinitionException(beanName); } @@ -725,8 +725,8 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto @Override public void preInstantiateSingletons() throws BeansException { - if (this.logger.isDebugEnabled()) { - this.logger.debug("Pre-instantiating singletons in " + this); + if (logger.isDebugEnabled()) { + logger.debug("Pre-instantiating singletons in " + this); } // Iterate over a copy to allow for init methods which in turn register new bean definitions. @@ -813,22 +813,22 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto } else if (oldBeanDefinition.getRole() < beanDefinition.getRole()) { // e.g. was ROLE_APPLICATION, now overriding with ROLE_SUPPORT or ROLE_INFRASTRUCTURE - if (this.logger.isWarnEnabled()) { - this.logger.warn("Overriding user-defined bean definition for bean '" + beanName + + if (logger.isWarnEnabled()) { + logger.warn("Overriding user-defined bean definition for bean '" + beanName + "' with a framework-generated bean definition: replacing [" + oldBeanDefinition + "] with [" + beanDefinition + "]"); } } else if (!beanDefinition.equals(oldBeanDefinition)) { - if (this.logger.isInfoEnabled()) { - this.logger.info("Overriding bean definition for bean '" + beanName + + if (logger.isInfoEnabled()) { + logger.info("Overriding bean definition for bean '" + beanName + "' with a different definition: replacing [" + oldBeanDefinition + "] with [" + beanDefinition + "]"); } } else { - if (this.logger.isDebugEnabled()) { - this.logger.debug("Overriding bean definition for bean '" + beanName + + if (logger.isDebugEnabled()) { + logger.debug("Overriding bean definition for bean '" + beanName + "' with an equivalent definition: replacing [" + oldBeanDefinition + "] with [" + beanDefinition + "]"); } @@ -871,8 +871,8 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto BeanDefinition bd = this.beanDefinitionMap.remove(beanName); if (bd == null) { - if (this.logger.isTraceEnabled()) { - this.logger.trace("No bean named '" + beanName + "' found in " + this); + if (logger.isTraceEnabled()) { + logger.trace("No bean named '" + beanName + "' found in " + this); } throw new NoSuchBeanDefinitionException(beanName); } diff --git a/spring-context/src/main/java/org/springframework/remoting/support/SimpleHttpServerFactoryBean.java b/spring-context/src/main/java/org/springframework/remoting/support/SimpleHttpServerFactoryBean.java index 47a4452514..771826239a 100644 --- a/spring-context/src/main/java/org/springframework/remoting/support/SimpleHttpServerFactoryBean.java +++ b/spring-context/src/main/java/org/springframework/remoting/support/SimpleHttpServerFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2016 the original author or authors. + * Copyright 2002-2018 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. @@ -163,8 +163,8 @@ public class SimpleHttpServerFactoryBean implements FactoryBean, Ini } }); } - if (this.logger.isInfoEnabled()) { - this.logger.info("Starting HttpServer at address " + address); + if (logger.isInfoEnabled()) { + logger.info("Starting HttpServer at address " + address); } this.server.start(); } diff --git a/spring-core/src/main/java/org/springframework/core/SimpleAliasRegistry.java b/spring-core/src/main/java/org/springframework/core/SimpleAliasRegistry.java index 58cc5a8968..6f9f5ee7c2 100644 --- a/spring-core/src/main/java/org/springframework/core/SimpleAliasRegistry.java +++ b/spring-core/src/main/java/org/springframework/core/SimpleAliasRegistry.java @@ -69,7 +69,7 @@ public class SimpleAliasRegistry implements AliasRegistry { throw new IllegalStateException("Cannot define alias '" + alias + "' for name '" + name + "': It is already registered for name '" + registeredName + "'."); } - if (this.logger.isInfoEnabled()) { + if (logger.isInfoEnabled()) { logger.info("Overriding alias '" + alias + "' definition for registered name '" + registeredName + "' with new target name '" + name + "'"); } diff --git a/spring-core/src/main/java/org/springframework/util/CommonsLogWriter.java b/spring-core/src/main/java/org/springframework/util/CommonsLogWriter.java index 30bdb0861e..8421f318d9 100644 --- a/spring-core/src/main/java/org/springframework/util/CommonsLogWriter.java +++ b/spring-core/src/main/java/org/springframework/util/CommonsLogWriter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2018 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. @@ -45,7 +45,7 @@ public class CommonsLogWriter extends Writer { public void write(char ch) { if (ch == '\n' && this.buffer.length() > 0) { - this.logger.debug(this.buffer.toString()); + logger.debug(this.buffer.toString()); this.buffer.setLength(0); } else { @@ -58,7 +58,7 @@ public class CommonsLogWriter extends Writer { for (int i = 0; i < length; i++) { char ch = buffer[offset + i]; if (ch == '\n' && this.buffer.length() > 0) { - this.logger.debug(this.buffer.toString()); + logger.debug(this.buffer.toString()); this.buffer.setLength(0); } else { diff --git a/spring-jcl/src/main/java/org/apache/commons/logging/LogFactory.java b/spring-jcl/src/main/java/org/apache/commons/logging/LogFactory.java index add48d588e..d18f89ec97 100644 --- a/spring-jcl/src/main/java/org/apache/commons/logging/LogFactory.java +++ b/spring-jcl/src/main/java/org/apache/commons/logging/LogFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2018 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. @@ -603,7 +603,7 @@ public abstract class LogFactory { } private void log(java.util.logging.Level level, Object message, Throwable exception) { - if (logger.isLoggable(level)) { + if (this.logger.isLoggable(level)) { LogRecord rec; if (message instanceof LogRecord) { rec = (LogRecord) message; diff --git a/spring-messaging/src/main/java/org/springframework/messaging/core/GenericMessagingTemplate.java b/spring-messaging/src/main/java/org/springframework/messaging/core/GenericMessagingTemplate.java index 29a82ae106..4b0b0c086d 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/core/GenericMessagingTemplate.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/core/GenericMessagingTemplate.java @@ -206,8 +206,8 @@ public class GenericMessagingTemplate extends AbstractDestinationResolvingMessag Message message = (timeout >= 0 ? ((PollableChannel) channel).receive(timeout) : ((PollableChannel) channel).receive()); - if (message == null && this.logger.isTraceEnabled()) { - this.logger.trace("Failed to receive message from channel '" + channel + "' within timeout: " + timeout); + if (message == null && logger.isTraceEnabled()) { + logger.trace("Failed to receive message from channel '" + channel + "' within timeout: " + timeout); } return message; diff --git a/spring-web/src/main/java/org/springframework/http/server/reactive/AbstractListenerReadPublisher.java b/spring-web/src/main/java/org/springframework/http/server/reactive/AbstractListenerReadPublisher.java index f7473ea10e..28df306096 100644 --- a/spring-web/src/main/java/org/springframework/http/server/reactive/AbstractListenerReadPublisher.java +++ b/spring-web/src/main/java/org/springframework/http/server/reactive/AbstractListenerReadPublisher.java @@ -82,7 +82,7 @@ public abstract class AbstractListenerReadPublisher implements Publisher { * container. */ public final void onDataAvailable() { - this.logger.trace("I/O event onDataAvailable"); + logger.trace("I/O event onDataAvailable"); this.state.get().onDataAvailable(this); } @@ -91,7 +91,7 @@ public abstract class AbstractListenerReadPublisher implements Publisher { * all data has been read. */ public void onAllDataRead() { - this.logger.trace("I/O event onAllDataRead"); + logger.trace("I/O event onAllDataRead"); this.state.get().onAllDataRead(this); } @@ -99,8 +99,8 @@ public abstract class AbstractListenerReadPublisher implements Publisher { * Sub-classes can call this to delegate container error notifications. */ public final void onError(Throwable ex) { - if (this.logger.isTraceEnabled()) { - this.logger.trace("I/O event onError: " + ex); + if (logger.isTraceEnabled()) { + logger.trace("I/O event onError: " + ex); } this.state.get().onError(this, ex); } diff --git a/spring-web/src/main/java/org/springframework/http/server/reactive/AbstractListenerWriteFlushProcessor.java b/spring-web/src/main/java/org/springframework/http/server/reactive/AbstractListenerWriteFlushProcessor.java index de0ea4d7b0..e51169c242 100644 --- a/spring-web/src/main/java/org/springframework/http/server/reactive/AbstractListenerWriteFlushProcessor.java +++ b/spring-web/src/main/java/org/springframework/http/server/reactive/AbstractListenerWriteFlushProcessor.java @@ -103,7 +103,7 @@ public abstract class AbstractListenerWriteFlushProcessor implements Processo * container to cancel the upstream subscription. */ protected void cancel() { - this.logger.trace("Received request to cancel"); + logger.trace("Received request to cancel"); if (this.subscription != null) { this.subscription.cancel(); } diff --git a/spring-web/src/main/java/org/springframework/http/server/reactive/AbstractListenerWriteProcessor.java b/spring-web/src/main/java/org/springframework/http/server/reactive/AbstractListenerWriteProcessor.java index ce9793e021..5a1b5edaeb 100644 --- a/spring-web/src/main/java/org/springframework/http/server/reactive/AbstractListenerWriteProcessor.java +++ b/spring-web/src/main/java/org/springframework/http/server/reactive/AbstractListenerWriteProcessor.java @@ -100,7 +100,7 @@ public abstract class AbstractListenerWriteProcessor implements Processor implements Processor 0) { int written = writeToOutputStream(dataBuffer); - if (this.logger.isTraceEnabled()) { - this.logger.trace("written: " + written + " total: " + remaining); + if (logger.isTraceEnabled()) { + logger.trace("written: " + written + " total: " + remaining); } if (written == remaining) { if (logger.isTraceEnabled()) { diff --git a/spring-web/src/main/java/org/springframework/remoting/jaxws/SimpleHttpServerJaxWsServiceExporter.java b/spring-web/src/main/java/org/springframework/remoting/jaxws/SimpleHttpServerJaxWsServiceExporter.java index 1c8fbad4b5..96b25e5840 100644 --- a/spring-web/src/main/java/org/springframework/remoting/jaxws/SimpleHttpServerJaxWsServiceExporter.java +++ b/spring-web/src/main/java/org/springframework/remoting/jaxws/SimpleHttpServerJaxWsServiceExporter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2018 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. @@ -164,8 +164,8 @@ public class SimpleHttpServerJaxWsServiceExporter extends AbstractJaxWsServiceEx InetSocketAddress address = (this.hostname != null ? new InetSocketAddress(this.hostname, this.port) : new InetSocketAddress(this.port)); HttpServer server = HttpServer.create(address, this.backlog); - if (this.logger.isInfoEnabled()) { - this.logger.info("Starting HttpServer at address " + address); + if (logger.isInfoEnabled()) { + logger.info("Starting HttpServer at address " + address); } server.start(); this.server = server; diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/FrameworkServlet.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/FrameworkServlet.java index 5f9679ad3f..a04cb2d008 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/FrameworkServlet.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/FrameworkServlet.java @@ -492,8 +492,8 @@ public abstract class FrameworkServlet extends HttpServletBean implements Applic @Override protected final void initServletBean() throws ServletException { getServletContext().log("Initializing Spring FrameworkServlet '" + getServletName() + "'"); - if (this.logger.isInfoEnabled()) { - this.logger.info("FrameworkServlet '" + getServletName() + "': initialization started"); + if (logger.isInfoEnabled()) { + logger.info("FrameworkServlet '" + getServletName() + "': initialization started"); } long startTime = System.currentTimeMillis(); @@ -502,13 +502,13 @@ public abstract class FrameworkServlet extends HttpServletBean implements Applic initFrameworkServlet(); } catch (ServletException | RuntimeException ex) { - this.logger.error("Context initialization failed", ex); + logger.error("Context initialization failed", ex); throw ex; } - if (this.logger.isInfoEnabled()) { + if (logger.isInfoEnabled()) { long elapsedTime = System.currentTimeMillis() - startTime; - this.logger.info("FrameworkServlet '" + getServletName() + "': initialization completed in " + + logger.info("FrameworkServlet '" + getServletName() + "': initialization completed in " + elapsedTime + " ms"); } } @@ -567,8 +567,8 @@ public abstract class FrameworkServlet extends HttpServletBean implements Applic // Publish the context as a servlet context attribute. String attrName = getServletContextAttributeName(); getServletContext().setAttribute(attrName, wac); - if (this.logger.isTraceEnabled()) { - this.logger.trace("Published WebApplicationContext of servlet '" + getServletName() + + if (logger.isTraceEnabled()) { + logger.trace("Published WebApplicationContext of servlet '" + getServletName() + "' as ServletContext attribute [" + attrName + "]"); } } @@ -617,8 +617,8 @@ public abstract class FrameworkServlet extends HttpServletBean implements Applic */ protected WebApplicationContext createWebApplicationContext(@Nullable ApplicationContext parent) { Class contextClass = getContextClass(); - if (this.logger.isTraceEnabled()) { - this.logger.trace("Servlet '" + getServletName() + + if (logger.isTraceEnabled()) { + logger.trace("Servlet '" + getServletName() + "' will create custom WebApplicationContext context of class '" + contextClass.getName() + "'" + ", parent context [" + parent + "]"); }