Revised log levels: less WARN and INFO, fine-tuned DEBUG vs TRACE

Issue: SPR-16946
This commit is contained in:
Juergen Hoeller
2018-07-20 15:05:13 +02:00
parent a410d90439
commit 9a43d2ec20
99 changed files with 461 additions and 486 deletions

View File

@@ -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.
@@ -77,9 +77,9 @@ public class AutoProxyRegistrar implements ImportBeanDefinitionRegistrar {
}
}
}
if (!candidateFound) {
if (!candidateFound && logger.isInfoEnabled()) {
String name = getClass().getSimpleName();
logger.warn(String.format("%s was imported but no annotations were found " +
logger.info(String.format("%s was imported but no annotations were found " +
"having both 'mode' and 'proxyTargetClass' attributes of type " +
"AdviceMode and boolean respectively. This means that auto proxy " +
"creator registration and configuration may not have occurred as " +

View File

@@ -309,8 +309,8 @@ class ConfigurationClassBeanDefinitionReader {
throw new BeanDefinitionStoreException(beanMethod.getConfigurationClass().getResource().getDescription(),
beanName, "@Bean definition illegally overridden by existing bean definition: " + existingBeanDef);
}
if (logger.isInfoEnabled()) {
logger.info(String.format("Skipping bean definition for %s: a definition for bean '%s' " +
if (logger.isDebugEnabled()) {
logger.debug(String.format("Skipping bean definition for %s: a definition for bean '%s' " +
"already exists. This top-level bean definition is considered as an override.",
beanMethod, beanName));
}

View File

@@ -348,9 +348,9 @@ class ConfigurationClassEnhancer {
// The factory is calling the bean method in order to instantiate and register the bean
// (i.e. via a getBean() call) -> invoke the super implementation of the method to actually
// create the bean instance.
if (logger.isWarnEnabled() &&
if (logger.isInfoEnabled() &&
BeanFactoryPostProcessor.class.isAssignableFrom(beanMethod.getReturnType())) {
logger.warn(String.format("@Bean method %s.%s is non-static and returns an object " +
logger.info(String.format("@Bean method %s.%s is non-static and returns an object " +
"assignable to Spring's BeanFactoryPostProcessor interface. This will " +
"result in a failure to process annotations such as @Autowired, " +
"@Resource and @PostConstruct within the method's declaring " +
@@ -490,8 +490,8 @@ class ConfigurationClassEnhancer {
boolean finalMethod = Modifier.isFinal(clazz.getMethod("getObject").getModifiers());
if (finalClass || finalMethod) {
if (exposedType.isInterface()) {
if (logger.isDebugEnabled()) {
logger.debug("Creating interface proxy for FactoryBean '" + beanName + "' of type [" +
if (logger.isTraceEnabled()) {
logger.trace("Creating interface proxy for FactoryBean '" + beanName + "' of type [" +
clazz.getName() + "] for use within another @Bean method because its " +
(finalClass ? "implementation class" : "getObject() method") +
" is final: Otherwise a getObject() call would not be routed to the factory.");
@@ -499,8 +499,8 @@ class ConfigurationClassEnhancer {
return createInterfaceProxyForFactoryBean(factoryBean, exposedType, beanFactory, beanName);
}
else {
if (logger.isInfoEnabled()) {
logger.info("Unable to proxy FactoryBean '" + beanName + "' of type [" +
if (logger.isDebugEnabled()) {
logger.debug("Unable to proxy FactoryBean '" + beanName + "' of type [" +
clazz.getName() + "] for use within another @Bean method because its " +
(finalClass ? "implementation class" : "getObject() method") +
" is final: A getObject() call will NOT be routed to the factory. " +

View File

@@ -272,7 +272,7 @@ class ConfigurationClassParser {
processPropertySource(propertySource);
}
else {
logger.warn("Ignoring @PropertySource annotation on [" + sourceClass.getMetadata().getClassName() +
logger.info("Ignoring @PropertySource annotation on [" + sourceClass.getMetadata().getClassName() +
"]. Reason: Environment must implement ConfigurableEnvironment");
}
}

View File

@@ -376,8 +376,8 @@ public class ConfigurationClassPostProcessor implements BeanDefinitionRegistryPo
throw new BeanDefinitionStoreException("Cannot enhance @Configuration bean definition '" +
beanName + "' since it is not stored in an AbstractBeanDefinition subclass");
}
else if (logger.isWarnEnabled() && beanFactory.containsSingleton(beanName)) {
logger.warn("Cannot enhance @Configuration bean definition '" + beanName +
else if (logger.isInfoEnabled() && beanFactory.containsSingleton(beanName)) {
logger.info("Cannot enhance @Configuration bean definition '" + beanName +
"' since its singleton instance has been created too early. The typical cause " +
"is a non-static @Bean method with a BeanDefinitionRegistryPostProcessor " +
"return type: Consider declaring such methods as 'static'.");

View File

@@ -376,9 +376,6 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
*/
protected void publishEvent(Object event, @Nullable ResolvableType eventType) {
Assert.notNull(event, "Event must not be null");
if (logger.isTraceEnabled()) {
logger.trace("Publishing event in " + getDisplayName() + ": " + event);
}
// Decorate event as an ApplicationEvent if necessary
ApplicationEvent applicationEvent;
@@ -586,8 +583,8 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
this.closed.set(false);
this.active.set(true);
if (logger.isInfoEnabled()) {
logger.info("Refreshing " + this);
if (logger.isDebugEnabled()) {
logger.debug("Refreshing " + this);
}
// Initialize any placeholder property sources in the context environment
@@ -619,11 +616,7 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
*/
protected ConfigurableListableBeanFactory obtainFreshBeanFactory() {
refreshBeanFactory();
ConfigurableListableBeanFactory beanFactory = getBeanFactory();
if (logger.isDebugEnabled()) {
logger.debug("Bean factory for " + getDisplayName() + ": " + beanFactory);
}
return beanFactory;
return getBeanFactory();
}
/**
@@ -727,8 +720,8 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
hms.setParentMessageSource(getInternalParentMessageSource());
}
}
if (logger.isDebugEnabled()) {
logger.debug("Using MessageSource [" + this.messageSource + "]");
if (logger.isTraceEnabled()) {
logger.trace("Using MessageSource [" + this.messageSource + "]");
}
}
else {
@@ -737,8 +730,8 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
dms.setParentMessageSource(getInternalParentMessageSource());
this.messageSource = dms;
beanFactory.registerSingleton(MESSAGE_SOURCE_BEAN_NAME, this.messageSource);
if (logger.isDebugEnabled()) {
logger.debug("Unable to locate MessageSource with name '" + MESSAGE_SOURCE_BEAN_NAME +
if (logger.isTraceEnabled()) {
logger.trace("Unable to locate MessageSource with name '" + MESSAGE_SOURCE_BEAN_NAME +
"': using default [" + this.messageSource + "]");
}
}
@@ -754,15 +747,15 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
if (beanFactory.containsLocalBean(APPLICATION_EVENT_MULTICASTER_BEAN_NAME)) {
this.applicationEventMulticaster =
beanFactory.getBean(APPLICATION_EVENT_MULTICASTER_BEAN_NAME, ApplicationEventMulticaster.class);
if (logger.isDebugEnabled()) {
logger.debug("Using ApplicationEventMulticaster [" + this.applicationEventMulticaster + "]");
if (logger.isTraceEnabled()) {
logger.trace("Using ApplicationEventMulticaster [" + this.applicationEventMulticaster + "]");
}
}
else {
this.applicationEventMulticaster = new SimpleApplicationEventMulticaster(beanFactory);
beanFactory.registerSingleton(APPLICATION_EVENT_MULTICASTER_BEAN_NAME, this.applicationEventMulticaster);
if (logger.isDebugEnabled()) {
logger.debug("Unable to locate ApplicationEventMulticaster with name '" +
if (logger.isTraceEnabled()) {
logger.trace("Unable to locate ApplicationEventMulticaster with name '" +
APPLICATION_EVENT_MULTICASTER_BEAN_NAME +
"': using default [" + this.applicationEventMulticaster + "]");
}
@@ -779,8 +772,8 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
if (beanFactory.containsLocalBean(LIFECYCLE_PROCESSOR_BEAN_NAME)) {
this.lifecycleProcessor =
beanFactory.getBean(LIFECYCLE_PROCESSOR_BEAN_NAME, LifecycleProcessor.class);
if (logger.isDebugEnabled()) {
logger.debug("Using LifecycleProcessor [" + this.lifecycleProcessor + "]");
if (logger.isTraceEnabled()) {
logger.trace("Using LifecycleProcessor [" + this.lifecycleProcessor + "]");
}
}
else {
@@ -788,8 +781,8 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
defaultProcessor.setBeanFactory(beanFactory);
this.lifecycleProcessor = defaultProcessor;
beanFactory.registerSingleton(LIFECYCLE_PROCESSOR_BEAN_NAME, this.lifecycleProcessor);
if (logger.isDebugEnabled()) {
logger.debug("Unable to locate LifecycleProcessor with name '" +
if (logger.isTraceEnabled()) {
logger.trace("Unable to locate LifecycleProcessor with name '" +
LIFECYCLE_PROCESSOR_BEAN_NAME +
"': using default [" + this.lifecycleProcessor + "]");
}
@@ -989,8 +982,8 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
*/
protected void doClose() {
if (this.active.get() && this.closed.compareAndSet(false, true)) {
if (logger.isInfoEnabled()) {
logger.info("Closing " + this);
if (logger.isDebugEnabled()) {
logger.debug("Closing " + this);
}
LiveBeansView.unregisterApplicationContext(this);

View File

@@ -349,8 +349,8 @@ public class DefaultLifecycleProcessor implements LifecycleProcessor, BeanFactor
if (this.members.isEmpty()) {
return;
}
if (logger.isInfoEnabled()) {
logger.info("Starting beans in phase " + this.phase);
if (logger.isDebugEnabled()) {
logger.debug("Starting beans in phase " + this.phase);
}
Collections.sort(this.members);
for (LifecycleGroupMember member : this.members) {
@@ -364,8 +364,8 @@ public class DefaultLifecycleProcessor implements LifecycleProcessor, BeanFactor
if (this.members.isEmpty()) {
return;
}
if (logger.isInfoEnabled()) {
logger.info("Stopping beans in phase " + this.phase);
if (logger.isDebugEnabled()) {
logger.debug("Stopping beans in phase " + this.phase);
}
this.members.sort(Collections.reverseOrder());
CountDownLatch latch = new CountDownLatch(this.smartMemberCount);

View File

@@ -75,21 +75,21 @@ public class DefaultContextLoadTimeWeaver implements LoadTimeWeaver, BeanClassLo
public void setBeanClassLoader(ClassLoader classLoader) {
LoadTimeWeaver serverSpecificLoadTimeWeaver = createServerSpecificLoadTimeWeaver(classLoader);
if (serverSpecificLoadTimeWeaver != null) {
if (logger.isInfoEnabled()) {
logger.info("Determined server-specific load-time weaver: " +
if (logger.isDebugEnabled()) {
logger.debug("Determined server-specific load-time weaver: " +
serverSpecificLoadTimeWeaver.getClass().getName());
}
this.loadTimeWeaver = serverSpecificLoadTimeWeaver;
}
else if (InstrumentationLoadTimeWeaver.isInstrumentationAvailable()) {
logger.info("Found Spring's JVM agent for instrumentation");
logger.debug("Found Spring's JVM agent for instrumentation");
this.loadTimeWeaver = new InstrumentationLoadTimeWeaver(classLoader);
}
else {
try {
this.loadTimeWeaver = new ReflectiveLoadTimeWeaver(classLoader);
if (logger.isInfoEnabled()) {
logger.info("Using a reflective load-time weaver for class loader: " +
if (logger.isDebugEnabled()) {
logger.debug("Using reflective load-time weaver for class loader: " +
this.loadTimeWeaver.getInstrumentableClassLoader().getClass().getName());
}
}
@@ -137,8 +137,8 @@ public class DefaultContextLoadTimeWeaver implements LoadTimeWeaver, BeanClassLo
@Override
public void destroy() {
if (this.loadTimeWeaver instanceof InstrumentationLoadTimeWeaver) {
if (logger.isInfoEnabled()) {
logger.info("Removing all registered transformers for class loader: " +
if (logger.isDebugEnabled()) {
logger.debug("Removing all registered transformers for class loader: " +
this.loadTimeWeaver.getInstrumentableClassLoader().getClass().getName());
}
((InstrumentationLoadTimeWeaver) this.loadTimeWeaver).removeTransformers();

View File

@@ -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.
@@ -112,8 +112,8 @@ public class ReflectiveLoadTimeWeaver implements LoadTimeWeaver {
this.classLoader.getClass(), GET_THROWAWAY_CLASS_LOADER_METHOD_NAME);
// getThrowawayClassLoader method is optional
if (getThrowawayClassLoaderMethod == null) {
if (logger.isInfoEnabled()) {
logger.info("The ClassLoader [" + classLoader.getClass().getName() + "] does NOT provide a " +
if (logger.isDebugEnabled()) {
logger.debug("The ClassLoader [" + classLoader.getClass().getName() + "] does NOT provide a " +
"'getThrowawayClassLoader()' method; SimpleThrowawayClassLoader will be used instead.");
}
}

View File

@@ -405,7 +405,7 @@ public class MBeanExporter extends MBeanRegistrationSupport implements MBeanExpo
this.beanFactory = (ListableBeanFactory) beanFactory;
}
else {
logger.info("MBeanExporter not running in a ListableBeanFactory: autodetection of MBeans not available.");
logger.debug("MBeanExporter not running in a ListableBeanFactory: autodetection of MBeans not available.");
}
}
@@ -430,7 +430,7 @@ public class MBeanExporter extends MBeanRegistrationSupport implements MBeanExpo
@Override
public void afterSingletonsInstantiated() {
try {
logger.info("Registering beans for JMX exposure on startup");
logger.debug("Registering beans for JMX exposure on startup");
registerBeans();
registerNotificationListeners();
}
@@ -448,7 +448,7 @@ public class MBeanExporter extends MBeanRegistrationSupport implements MBeanExpo
*/
@Override
public void destroy() {
logger.info("Unregistering JMX-exposed beans on shutdown");
logger.debug("Unregistering JMX-exposed beans on shutdown");
unregisterNotificationListeners();
unregisterBeans();
}
@@ -664,15 +664,15 @@ public class MBeanExporter extends MBeanRegistrationSupport implements MBeanExpo
}
if (mbeanToExpose != null) {
if (logger.isInfoEnabled()) {
logger.info("Located MBean '" + beanKey + "': registering with JMX server as MBean [" +
if (logger.isDebugEnabled()) {
logger.debug("Located MBean '" + beanKey + "': registering with JMX server as MBean [" +
objectName + "]");
}
doRegister(mbeanToExpose, objectName);
}
else {
if (logger.isInfoEnabled()) {
logger.info("Located managed bean '" + beanKey + "': registering with JMX server as MBean [" +
if (logger.isDebugEnabled()) {
logger.debug("Located managed bean '" + beanKey + "': registering with JMX server as MBean [" +
objectName + "]");
}
ModelMBean mbean = createAndConfigureMBean(bean, beanKey);
@@ -845,9 +845,9 @@ public class MBeanExporter extends MBeanRegistrationSupport implements MBeanExpo
*/
private ModelMBeanInfo getMBeanInfo(Object managedBean, String beanKey) throws JMException {
ModelMBeanInfo info = this.assembler.getMBeanInfo(managedBean, beanKey);
if (logger.isWarnEnabled() && ObjectUtils.isEmpty(info.getAttributes()) &&
if (logger.isInfoEnabled() && ObjectUtils.isEmpty(info.getAttributes()) &&
ObjectUtils.isEmpty(info.getOperations())) {
logger.warn("Bean with key '" + beanKey +
logger.info("Bean with key '" + beanKey +
"' has been registered as an MBean but has no exposed attributes or operations");
}
return info;
@@ -891,13 +891,13 @@ public class MBeanExporter extends MBeanRegistrationSupport implements MBeanExpo
!CollectionUtils.containsInstance(beans.values(), beanInstance))) {
// Not already registered for JMX exposure.
beans.put(beanName, (beanInstance != null ? beanInstance : beanName));
if (logger.isInfoEnabled()) {
logger.info("Bean with name '" + beanName + "' has been autodetected for JMX exposure");
if (logger.isDebugEnabled()) {
logger.debug("Bean with name '" + beanName + "' has been autodetected for JMX exposure");
}
}
else {
if (logger.isDebugEnabled()) {
logger.debug("Bean with name '" + beanName + "' is already registered for JMX exposure");
if (logger.isTraceEnabled()) {
logger.trace("Bean with name '" + beanName + "' is already registered for JMX exposure");
}
}
}
@@ -1103,8 +1103,8 @@ public class MBeanExporter extends MBeanRegistrationSupport implements MBeanExpo
return super.getTarget();
}
catch (RuntimeException ex) {
if (logger.isWarnEnabled()) {
logger.warn("Failed to retrieve target for JMX-exposed bean [" + this.objectName + "]: " + ex);
if (logger.isInfoEnabled()) {
logger.info("Failed to retrieve target for JMX-exposed bean [" + this.objectName + "]: " + ex);
}
throw ex;
}

View File

@@ -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.
@@ -118,8 +118,8 @@ public class KeyNamingStrategy implements ObjectNamingStrategy, InitializingBean
if (this.mappingLocations != null) {
for (Resource location : this.mappingLocations) {
if (logger.isInfoEnabled()) {
logger.info("Loading JMX object name mappings file from " + location);
if (logger.isDebugEnabled()) {
logger.debug("Loading JMX object name mappings file from " + location);
}
PropertiesLoaderUtils.fillProperties(this.mergedMappings, location);
}

View File

@@ -96,8 +96,8 @@ public abstract class JmxUtils {
List<MBeanServer> servers = MBeanServerFactory.findMBeanServer(agentId);
if (!CollectionUtils.isEmpty(servers)) {
// Check to see if an MBeanServer is registered.
if (servers.size() > 1 && logger.isWarnEnabled()) {
logger.warn("Found more than one MBeanServer instance" +
if (servers.size() > 1 && logger.isInfoEnabled()) {
logger.info("Found more than one MBeanServer instance" +
(agentId != null ? " with agent id [" + agentId + "]" : "") +
". Returning first from list.");
}

View File

@@ -151,7 +151,9 @@ public class MBeanRegistrationSupport {
registeredBean = this.server.registerMBean(mbean, objectName);
}
catch (InstanceNotFoundException ex2) {
logger.error("Unable to replace existing MBean at [" + objectName + "]", ex2);
if (logger.isInfoEnabled()) {
logger.info("Unable to replace existing MBean at [" + objectName + "]", ex2);
}
throw ex;
}
}
@@ -180,10 +182,10 @@ public class MBeanRegistrationSupport {
snapshot = new LinkedHashSet<>(this.registeredBeans);
}
if (!snapshot.isEmpty()) {
logger.info("Unregistering JMX-exposed beans");
}
for (ObjectName objectName : snapshot) {
doUnregister(objectName);
logger.debug("Unregistering JMX-exposed beans");
for (ObjectName objectName : snapshot) {
doUnregister(objectName);
}
}
}
@@ -204,15 +206,15 @@ public class MBeanRegistrationSupport {
actuallyUnregistered = true;
}
else {
if (logger.isWarnEnabled()) {
logger.warn("Could not unregister MBean [" + objectName + "] as said MBean " +
if (logger.isInfoEnabled()) {
logger.info("Could not unregister MBean [" + objectName + "] as said MBean " +
"is not registered (perhaps already unregistered by an external process)");
}
}
}
catch (JMException ex) {
if (logger.isErrorEnabled()) {
logger.error("Could not unregister MBean [" + objectName + "]", ex);
if (logger.isInfoEnabled()) {
logger.info("Could not unregister MBean [" + objectName + "]", ex);
}
}
}

View File

@@ -135,7 +135,7 @@ public class MBeanServerFactoryBean implements FactoryBean<MBeanServer>, Initial
if (this.agentId != null) {
throw ex;
}
logger.info("No existing MBeanServer found - creating new one");
logger.debug("No existing MBeanServer found - creating new one");
}
}

View File

@@ -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.
@@ -244,11 +244,11 @@ public class JndiObjectFactoryBean extends JndiObjectLocator
}
catch (NamingException ex) {
if (this.defaultObject != null) {
if (logger.isDebugEnabled()) {
logger.debug("JNDI lookup failed - returning specified default object instead", ex);
if (logger.isTraceEnabled()) {
logger.trace("JNDI lookup failed - returning specified default object instead", ex);
}
else if (logger.isInfoEnabled()) {
logger.info("JNDI lookup failed - returning specified default object instead: " + ex);
else if (logger.isDebugEnabled()) {
logger.debug("JNDI lookup failed - returning specified default object instead: " + ex);
}
return this.defaultObject;
}

View File

@@ -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.
@@ -321,8 +321,8 @@ public class JndiRmiClientInterceptor extends JndiObjectLocator implements Metho
if (logger.isDebugEnabled()) {
logger.debug("Could not connect to RMI service [" + getJndiName() + "] - retrying", ex);
}
else if (logger.isWarnEnabled()) {
logger.warn("Could not connect to RMI service [" + getJndiName() + "] - retrying");
else if (logger.isInfoEnabled()) {
logger.info("Could not connect to RMI service [" + getJndiName() + "] - retrying");
}
return refreshAndRetry(invocation);
}

View File

@@ -151,8 +151,8 @@ public class JndiRmiServiceExporter extends RmiBasedExporter implements Initiali
* @throws NamingException if service binding failed
*/
public void rebind() throws NamingException {
if (logger.isInfoEnabled()) {
logger.info("Binding RMI service to JNDI location [" + this.jndiName + "]");
if (logger.isDebugEnabled()) {
logger.debug("Binding RMI service to JNDI location [" + this.jndiName + "]");
}
this.jndiTemplate.rebind(this.jndiName, this.exportedObject);
}
@@ -162,8 +162,8 @@ public class JndiRmiServiceExporter extends RmiBasedExporter implements Initiali
*/
@Override
public void destroy() throws NamingException, RemoteException {
if (logger.isInfoEnabled()) {
logger.info("Unbinding RMI service from JNDI location [" + this.jndiName + "]");
if (logger.isDebugEnabled()) {
logger.debug("Unbinding RMI service from JNDI location [" + this.jndiName + "]");
}
this.jndiTemplate.unbind(this.jndiName);
invokePortableRemoteObject(unexportObject);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 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.
@@ -183,8 +183,8 @@ public class RmiRegistryFactoryBean implements FactoryBean<Registry>, Initializi
if (registryHost != null) {
// Host explicitly specified: only lookup possible.
if (logger.isInfoEnabled()) {
logger.info("Looking for RMI registry at port '" + registryPort + "' of host [" + registryHost + "]");
if (logger.isDebugEnabled()) {
logger.debug("Looking for RMI registry at port '" + registryPort + "' of host [" + registryHost + "]");
}
Registry reg = LocateRegistry.getRegistry(registryHost, registryPort, clientSocketFactory);
testRegistry(reg);
@@ -210,12 +210,12 @@ public class RmiRegistryFactoryBean implements FactoryBean<Registry>, Initializi
if (clientSocketFactory != null) {
if (this.alwaysCreate) {
logger.info("Creating new RMI registry");
logger.debug("Creating new RMI registry");
this.created = true;
return LocateRegistry.createRegistry(registryPort, clientSocketFactory, serverSocketFactory);
}
if (logger.isInfoEnabled()) {
logger.info("Looking for RMI registry at port '" + registryPort + "', using custom socket factory");
if (logger.isDebugEnabled()) {
logger.debug("Looking for RMI registry at port '" + registryPort + "', using custom socket factory");
}
synchronized (LocateRegistry.class) {
try {
@@ -225,8 +225,8 @@ public class RmiRegistryFactoryBean implements FactoryBean<Registry>, Initializi
return reg;
}
catch (RemoteException ex) {
logger.debug("RMI registry access threw exception", ex);
logger.info("Could not detect RMI registry - creating new one");
logger.trace("RMI registry access threw exception", ex);
logger.debug("Could not detect RMI registry - creating new one");
// Assume no registry found -> create new one.
this.created = true;
return LocateRegistry.createRegistry(registryPort, clientSocketFactory, serverSocketFactory);
@@ -247,12 +247,12 @@ public class RmiRegistryFactoryBean implements FactoryBean<Registry>, Initializi
*/
protected Registry getRegistry(int registryPort) throws RemoteException {
if (this.alwaysCreate) {
logger.info("Creating new RMI registry");
logger.debug("Creating new RMI registry");
this.created = true;
return LocateRegistry.createRegistry(registryPort);
}
if (logger.isInfoEnabled()) {
logger.info("Looking for RMI registry at port '" + registryPort + "'");
if (logger.isDebugEnabled()) {
logger.debug("Looking for RMI registry at port '" + registryPort + "'");
}
synchronized (LocateRegistry.class) {
try {
@@ -262,8 +262,8 @@ public class RmiRegistryFactoryBean implements FactoryBean<Registry>, Initializi
return reg;
}
catch (RemoteException ex) {
logger.debug("RMI registry access threw exception", ex);
logger.info("Could not detect RMI registry - creating new one");
logger.trace("RMI registry access threw exception", ex);
logger.debug("Could not detect RMI registry - creating new one");
// Assume no registry found -> create new one.
this.created = true;
return LocateRegistry.createRegistry(registryPort);
@@ -307,7 +307,7 @@ public class RmiRegistryFactoryBean implements FactoryBean<Registry>, Initializi
@Override
public void destroy() throws RemoteException {
if (this.created) {
logger.info("Unexporting RMI registry");
logger.debug("Unexporting RMI registry");
UnicastRemoteObject.unexportObject(this.registry, true);
}
}

View File

@@ -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.
@@ -273,8 +273,8 @@ public class RmiServiceExporter extends RmiBasedExporter implements Initializing
// Initialize and cache exported object.
this.exportedObject = getObjectToExport();
if (logger.isInfoEnabled()) {
logger.info("Binding service '" + this.serviceName + "' to RMI registry: " + this.registry);
if (logger.isDebugEnabled()) {
logger.debug("Binding service '" + this.serviceName + "' to RMI registry: " + this.registry);
}
// Export RMI object.
@@ -325,8 +325,8 @@ public class RmiServiceExporter extends RmiBasedExporter implements Initializing
if (registryHost != null) {
// Host explicitly specified: only lookup possible.
if (logger.isInfoEnabled()) {
logger.info("Looking for RMI registry at port '" + registryPort + "' of host [" + registryHost + "]");
if (logger.isDebugEnabled()) {
logger.debug("Looking for RMI registry at port '" + registryPort + "' of host [" + registryHost + "]");
}
Registry reg = LocateRegistry.getRegistry(registryHost, registryPort, clientSocketFactory);
testRegistry(reg);
@@ -352,11 +352,11 @@ public class RmiServiceExporter extends RmiBasedExporter implements Initializing
if (clientSocketFactory != null) {
if (this.alwaysCreateRegistry) {
logger.info("Creating new RMI registry");
logger.debug("Creating new RMI registry");
return LocateRegistry.createRegistry(registryPort, clientSocketFactory, serverSocketFactory);
}
if (logger.isInfoEnabled()) {
logger.info("Looking for RMI registry at port '" + registryPort + "', using custom socket factory");
if (logger.isDebugEnabled()) {
logger.debug("Looking for RMI registry at port '" + registryPort + "', using custom socket factory");
}
synchronized (LocateRegistry.class) {
try {
@@ -366,8 +366,8 @@ public class RmiServiceExporter extends RmiBasedExporter implements Initializing
return reg;
}
catch (RemoteException ex) {
logger.debug("RMI registry access threw exception", ex);
logger.info("Could not detect RMI registry - creating new one");
logger.trace("RMI registry access threw exception", ex);
logger.debug("Could not detect RMI registry - creating new one");
// Assume no registry found -> create new one.
return LocateRegistry.createRegistry(registryPort, clientSocketFactory, serverSocketFactory);
}
@@ -387,11 +387,11 @@ public class RmiServiceExporter extends RmiBasedExporter implements Initializing
*/
protected Registry getRegistry(int registryPort) throws RemoteException {
if (this.alwaysCreateRegistry) {
logger.info("Creating new RMI registry");
logger.debug("Creating new RMI registry");
return LocateRegistry.createRegistry(registryPort);
}
if (logger.isInfoEnabled()) {
logger.info("Looking for RMI registry at port '" + registryPort + "'");
if (logger.isDebugEnabled()) {
logger.debug("Looking for RMI registry at port '" + registryPort + "'");
}
synchronized (LocateRegistry.class) {
try {
@@ -401,8 +401,8 @@ public class RmiServiceExporter extends RmiBasedExporter implements Initializing
return reg;
}
catch (RemoteException ex) {
logger.debug("RMI registry access threw exception", ex);
logger.info("Could not detect RMI registry - creating new one");
logger.trace("RMI registry access threw exception", ex);
logger.debug("Could not detect RMI registry - creating new one");
// Assume no registry found -> create new one.
return LocateRegistry.createRegistry(registryPort);
}
@@ -427,17 +427,17 @@ public class RmiServiceExporter extends RmiBasedExporter implements Initializing
*/
@Override
public void destroy() throws RemoteException {
if (logger.isInfoEnabled()) {
logger.info("Unbinding RMI service '" + this.serviceName +
if (logger.isDebugEnabled()) {
logger.debug("Unbinding RMI service '" + this.serviceName +
"' from registry" + (this.createdRegistry ? (" at port '" + this.registryPort + "'") : ""));
}
try {
this.registry.unbind(this.serviceName);
}
catch (NotBoundException ex) {
if (logger.isWarnEnabled()) {
logger.warn("RMI service '" + this.serviceName + "' is not bound to registry"
+ (this.createdRegistry ? (" at port '" + this.registryPort + "' anymore") : ""), ex);
if (logger.isInfoEnabled()) {
logger.info("RMI service '" + this.serviceName + "' is not bound to registry" +
(this.createdRegistry ? (" at port '" + this.registryPort + "' anymore") : ""), ex);
}
}
finally {
@@ -453,8 +453,8 @@ public class RmiServiceExporter extends RmiBasedExporter implements Initializing
UnicastRemoteObject.unexportObject(this.exportedObject, true);
}
catch (NoSuchObjectException ex) {
if (logger.isWarnEnabled()) {
logger.warn("RMI object for service '" + this.serviceName + "' isn't exported anymore", ex);
if (logger.isInfoEnabled()) {
logger.info("RMI object for service '" + this.serviceName + "' is not exported anymore", ex);
}
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 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.
@@ -79,13 +79,13 @@ public abstract class RemoteInvocationBasedExporter extends RemoteExporter {
}
catch (NoSuchMethodException ex) {
if (logger.isDebugEnabled()) {
logger.warn("Could not find target method for " + invocation, ex);
logger.debug("Could not find target method for " + invocation, ex);
}
throw ex;
}
catch (IllegalAccessException ex) {
if (logger.isDebugEnabled()) {
logger.warn("Could not access target method for " + invocation, ex);
logger.debug("Could not access target method for " + invocation, ex);
}
throw ex;
}

View File

@@ -253,7 +253,7 @@ public class ScheduledAnnotationBeanPostProcessor
this.registrar.setTaskScheduler(resolveSchedulerBean(this.beanFactory, TaskScheduler.class, false));
}
catch (NoUniqueBeanDefinitionException ex) {
logger.debug("Could not find unique TaskScheduler bean", ex);
logger.trace("Could not find unique TaskScheduler bean", ex);
try {
this.registrar.setTaskScheduler(resolveSchedulerBean(this.beanFactory, TaskScheduler.class, true));
}
@@ -268,13 +268,13 @@ public class ScheduledAnnotationBeanPostProcessor
}
}
catch (NoSuchBeanDefinitionException ex) {
logger.debug("Could not find default TaskScheduler bean", ex);
logger.trace("Could not find default TaskScheduler bean", ex);
// Search for ScheduledExecutorService bean next...
try {
this.registrar.setScheduler(resolveSchedulerBean(this.beanFactory, ScheduledExecutorService.class, false));
}
catch (NoUniqueBeanDefinitionException ex2) {
logger.debug("Could not find unique ScheduledExecutorService bean", ex2);
logger.trace("Could not find unique ScheduledExecutorService bean", ex2);
try {
this.registrar.setScheduler(resolveSchedulerBean(this.beanFactory, ScheduledExecutorService.class, true));
}
@@ -289,7 +289,7 @@ public class ScheduledAnnotationBeanPostProcessor
}
}
catch (NoSuchBeanDefinitionException ex2) {
logger.debug("Could not find default ScheduledExecutorService bean", ex2);
logger.trace("Could not find default ScheduledExecutorService bean", ex2);
// Giving up -> falling back to default scheduler within the registrar...
logger.info("No TaskScheduler/ScheduledExecutorService bean found for scheduled processing");
}
@@ -350,8 +350,8 @@ public class ScheduledAnnotationBeanPostProcessor
// Non-empty set of methods
annotatedMethods.forEach((method, scheduledMethods) ->
scheduledMethods.forEach(scheduled -> processScheduled(scheduled, method, bean)));
if (logger.isDebugEnabled()) {
logger.debug(annotatedMethods.size() + " @Scheduled methods processed on bean '" + beanName +
if (logger.isTraceEnabled()) {
logger.trace(annotatedMethods.size() + " @Scheduled methods processed on bean '" + beanName +
"': " + annotatedMethods);
}
}

View File

@@ -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.
@@ -103,8 +103,8 @@ public class DefaultManagedAwareThreadFactory extends CustomizableThreadFactory
this.threadFactory = this.jndiLocator.lookup(this.jndiName, ThreadFactory.class);
}
catch (NamingException ex) {
if (logger.isDebugEnabled()) {
logger.debug("Failed to retrieve [" + this.jndiName + "] from JNDI", ex);
if (logger.isTraceEnabled()) {
logger.trace("Failed to retrieve [" + this.jndiName + "] from JNDI", ex);
}
logger.info("Could not find default managed thread factory in JNDI - " +
"proceeding with default local thread factory");

View File

@@ -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.
@@ -157,7 +157,7 @@ public class ScheduledExecutorFactoryBean extends ExecutorConfigurationSupport
((ScheduledThreadPoolExecutor) executor).setRemoveOnCancelPolicy(true);
}
else {
logger.info("Could not apply remove-on-cancel policy - not a Java 7+ ScheduledThreadPoolExecutor");
logger.debug("Could not apply remove-on-cancel policy - not a ScheduledThreadPoolExecutor");
}
}

View File

@@ -99,7 +99,7 @@ public class ThreadPoolTaskScheduler extends ExecutorConfigurationSupport
((ScheduledThreadPoolExecutor) this.scheduledExecutor).setRemoveOnCancelPolicy(removeOnCancelPolicy);
}
else if (removeOnCancelPolicy && this.scheduledExecutor != null) {
logger.info("Could not apply remove-on-cancel policy - not a Java 7+ ScheduledThreadPoolExecutor");
logger.debug("Could not apply remove-on-cancel policy - not a ScheduledThreadPoolExecutor");
}
}
@@ -122,7 +122,7 @@ public class ThreadPoolTaskScheduler extends ExecutorConfigurationSupport
((ScheduledThreadPoolExecutor) this.scheduledExecutor).setRemoveOnCancelPolicy(true);
}
else {
logger.info("Could not apply remove-on-cancel policy - not a Java 7+ ScheduledThreadPoolExecutor");
logger.debug("Could not apply remove-on-cancel policy - not a ScheduledThreadPoolExecutor");
}
}