Migrate from Slf4J to JCL.

Closes #2359
This commit is contained in:
Jens Schauder
2021-11-16 14:00:16 +01:00
parent fde0cf7cf1
commit 2231d574de
10 changed files with 45 additions and 45 deletions

View File

@@ -32,8 +32,8 @@ import javax.enterprise.inject.spi.BeanManager;
import javax.enterprise.inject.spi.ProcessBean;
import javax.persistence.EntityManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.data.repository.cdi.CdiRepositoryBean;
import org.springframework.data.repository.cdi.CdiRepositoryExtensionSupport;
@@ -47,7 +47,7 @@ import org.springframework.data.repository.cdi.CdiRepositoryExtensionSupport;
*/
public class JpaRepositoryExtension extends CdiRepositoryExtensionSupport {
private static final Logger LOGGER = LoggerFactory.getLogger(JpaRepositoryExtension.class);
private static final Log LOGGER = LogFactory.getLog(JpaRepositoryExtension.class);
private final Map<Set<Annotation>, Bean<EntityManager>> entityManagers = new HashMap<Set<Annotation>, Bean<EntityManager>>();
@@ -70,7 +70,7 @@ public class JpaRepositoryExtension extends CdiRepositoryExtensionSupport {
if (type instanceof Class<?> && EntityManager.class.isAssignableFrom((Class<?>) type)) {
Set<Annotation> qualifiers = new HashSet<Annotation>(bean.getQualifiers());
if (bean.isAlternative() || !entityManagers.containsKey(qualifiers)) {
LOGGER.debug("Discovered '{}' with qualifiers {}.", EntityManager.class.getName(), qualifiers);
LOGGER.debug(String.format("Discovered '%s' with qualifiers %s.", EntityManager.class.getName(), qualifiers));
entityManagers.put(qualifiers, (Bean<EntityManager>) bean);
}
}
@@ -93,7 +93,7 @@ public class JpaRepositoryExtension extends CdiRepositoryExtensionSupport {
// Create the bean representing the repository.
CdiRepositoryBean<?> repositoryBean = createRepositoryBean(repositoryType, qualifiers, beanManager);
LOGGER.info("Registering bean for '{}' with qualifiers {}.", repositoryType.getName(), qualifiers);
LOGGER.info(String.format("Registering bean for '%s' with qualifiers %s.", repositoryType.getName(), qualifiers));
// Register the bean to the extension and the container.
registerBean(repositoryBean);

View File

@@ -21,8 +21,8 @@ import java.util.Set;
import javax.persistence.EntityManagerFactory;
import javax.persistence.metamodel.Metamodel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactoryUtils;
import org.springframework.beans.factory.FactoryBean;
@@ -44,7 +44,7 @@ import org.springframework.lang.Nullable;
public class JpaMetamodelMappingContextFactoryBean extends AbstractFactoryBean<JpaMetamodelMappingContext>
implements ApplicationContextAware {
private static final Logger LOG = LoggerFactory.getLogger(JpaMetamodelMappingContextFactoryBean.class);
private static final Log LOG = LogFactory.getLog(JpaMetamodelMappingContextFactoryBean.class);
private @Nullable ListableBeanFactory beanFactory;

View File

@@ -19,8 +19,8 @@ import java.lang.reflect.Method;
import javax.persistence.EntityManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.projection.ProjectionFactory;
@@ -44,7 +44,7 @@ import org.springframework.util.StringUtils;
*/
public final class JpaQueryLookupStrategy {
private static final Logger LOG = LoggerFactory.getLogger(JpaQueryLookupStrategy.class);
private static final Log LOG = LogFactory.getLog(JpaQueryLookupStrategy.class);
/**
* Private constructor to prevent instantiation.

View File

@@ -20,9 +20,8 @@ import javax.persistence.Query;
import javax.persistence.Tuple;
import javax.persistence.TypedQuery;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.data.jpa.provider.QueryExtractor;
import org.springframework.data.repository.query.Parameters;
import org.springframework.data.repository.query.QueryCreationException;
@@ -45,7 +44,7 @@ final class NamedQuery extends AbstractJpaQuery {
+ "have a JpaDialect configured at your EntityManagerFactoryBean as this affects "
+ "discovering the concrete persistence provider.";
private static final Logger LOG = LoggerFactory.getLogger(NamedQuery.class);
private static final Log LOG = LogFactory.getLog(NamedQuery.class);
private final String queryName;
private final String countQueryName;
@@ -89,8 +88,9 @@ final class NamedQuery extends AbstractJpaQuery {
}
if (parameters.hasPageableParameter()) {
LOG.warn("Finder method {} is backed by a NamedQuery" + " but contains a Pageable parameter! Sorting delivered "
+ "via this Pageable will not be applied!", method);
LOG.warn(String.format(
"Finder method %s is backed by a NamedQuery but contains a Pageable parameter! Sorting delivered via this Pageable will not be applied!",
method));
}
this.metadataCache = new QueryParameterSetter.QueryMetadataCache();
@@ -115,7 +115,7 @@ final class NamedQuery extends AbstractJpaQuery {
lookupEm.createNamedQuery(queryName);
return true;
} catch (IllegalArgumentException e) {
LOG.debug("Did not find named query {}", queryName);
LOG.debug(String.format("Did not find named query %s", queryName));
return false;
} finally {
lookupEm.close();
@@ -134,7 +134,7 @@ final class NamedQuery extends AbstractJpaQuery {
final String queryName = method.getNamedQueryName();
LOG.debug("Looking up named query {}", queryName);
LOG.debug(String.format("Looking up named query %s", queryName));
if (!hasNamedQuery(em, queryName)) {
return null;
@@ -142,7 +142,7 @@ final class NamedQuery extends AbstractJpaQuery {
try {
RepositoryQuery query = new NamedQuery(method, em);
LOG.debug("Found named query {}!", queryName);
LOG.debug(String.format("Found named query %s!", queryName));
return query;
} catch (IllegalArgumentException e) {
return null;

View File

@@ -30,8 +30,8 @@ import javax.persistence.Query;
import javax.persistence.TemporalType;
import javax.persistence.criteria.ParameterExpression;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
@@ -155,7 +155,7 @@ interface QueryParameterSetter {
}
};
private static final Logger LOG = LoggerFactory.getLogger(ErrorHandling.class);
private static final Log LOG = LogFactory.getLog(ErrorHandling.class);
abstract void execute(Runnable block);
}
@@ -280,7 +280,7 @@ interface QueryParameterSetter {
} catch (RuntimeException e) {
LoggerFactory.getLogger(QueryMetadata.class).warn("Failed to unwrap actual class for Query proxy.", e);
LogFactory.getLog(QueryMetadata.class).warn("Failed to unwrap actual class for Query proxy.", e);
return queryType;
}

View File

@@ -25,7 +25,8 @@ import java.util.stream.Stream;
import javax.persistence.EntityManager;
import javax.persistence.Tuple;
import org.slf4j.Logger;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.dao.InvalidDataAccessApiUsageException;
import org.springframework.data.jpa.projection.CollectionAwareProjectionFactory;
@@ -304,8 +305,7 @@ public class JpaRepositoryFactory extends RepositoryFactorySupport {
private static final String ECLIPSELINK_PROJECTIONS = "Usage of Spring Data projections detected on persistence provider EclipseLink. Make sure the following query methods declare result columns in exactly the order the accessors are declared in the projecting interface or the order of parameters for DTOs:";
private static final Logger log = org.slf4j.LoggerFactory
.getLogger(EclipseLinkProjectionQueryCreationListener.class);
private static final Log log = LogFactory.getLog(EclipseLinkProjectionQueryCreationListener.class);
private final JpaMetamodel metamodel;
@@ -340,7 +340,7 @@ public class JpaRepositoryFactory extends RepositoryFactorySupport {
this.warningLogged = true;
}
log.info(" - {}", queryMethod);
log.info(String.format(" - %s", queryMethod));
}
}
}

View File

@@ -24,8 +24,8 @@ import java.util.Set;
import javax.persistence.Entity;
import javax.persistence.MappedSuperclass;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.EnvironmentAware;
import org.springframework.context.ResourceLoaderAware;
@@ -58,7 +58,7 @@ import org.springframework.util.StringUtils;
public class ClasspathScanningPersistenceUnitPostProcessor
implements PersistenceUnitPostProcessor, ResourceLoaderAware, EnvironmentAware {
private static final Logger LOG = LoggerFactory.getLogger(ClasspathScanningPersistenceUnitPostProcessor.class);
private static final Log LOG = LogFactory.getLog(ClasspathScanningPersistenceUnitPostProcessor.class);
private final String basePackage;
@@ -133,7 +133,7 @@ public class ClasspathScanningPersistenceUnitPostProcessor
for (BeanDefinition definition : provider.findCandidateComponents(basePackage)) {
LOG.debug("Registering classpath-scanned entity {} in persistence unit info!", definition.getBeanClassName());
LOG.debug(String.format("Registering classpath-scanned entity %s in persistence unit info!", definition.getBeanClassName()));
if (definition.getBeanClassName() != null) {
pui.addManagedClassName(definition.getBeanClassName());
@@ -142,7 +142,7 @@ public class ClasspathScanningPersistenceUnitPostProcessor
for (String location : scanForMappingFileLocations()) {
LOG.debug("Registering classpath-scanned entity mapping file {} in persistence unit info!", location);
LOG.debug(String.format("Registering classpath-scanned entity mapping file %s in persistence unit info!", location));
pui.addMappingFileName(location);
}

View File

@@ -20,8 +20,8 @@ import java.net.URL;
import javax.persistence.spi.PersistenceUnitInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager;
import org.springframework.orm.jpa.persistenceunit.MutablePersistenceUnitInfo;
@@ -34,7 +34,7 @@ import org.springframework.orm.jpa.persistenceunit.MutablePersistenceUnitInfo;
*/
public class MergingPersistenceUnitManager extends DefaultPersistenceUnitManager {
private static final Logger LOG = LoggerFactory.getLogger(MergingPersistenceUnitManager.class);
private static final Log LOG = LogFactory.getLog(MergingPersistenceUnitManager.class);
/*
* (non-Javadoc)
@@ -68,21 +68,21 @@ public class MergingPersistenceUnitManager extends DefaultPersistenceUnitManager
for (URL url : oldPui.getJarFileUrls()) {
if (!pui.getJarFileUrls().contains(url)) {
LOG.debug("Adding JAR file URL {} to persistence unit {}.", url, persistenceUnitName);
LOG.debug(String.format("Adding JAR file URL %s to persistence unit %s.", url, persistenceUnitName));
pui.addJarFileUrl(url);
}
}
for (String className : oldPui.getManagedClassNames()) {
if (!pui.getManagedClassNames().contains(className)) {
LOG.debug("Adding class {} to PersistenceUnit {}", className, persistenceUnitName);
LOG.debug(String.format("Adding class %s to PersistenceUnit %s", className, persistenceUnitName));
pui.addManagedClassName(className);
}
}
for (String mappingFileName : oldPui.getMappingFileNames()) {
if (!pui.getMappingFileNames().contains(mappingFileName)) {
LOG.debug("Adding mapping file to persistence unit {}.", mappingFileName, persistenceUnitName);
LOG.debug(String.format("Adding mapping file to persistence unit %s.", mappingFileName, persistenceUnitName));
pui.addMappingFileName(mappingFileName);
}
}

View File

@@ -26,8 +26,8 @@ import javax.enterprise.inject.spi.Bean;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* Integration tests for Spring Data JPA CDI extension.
@@ -40,7 +40,7 @@ import org.slf4j.LoggerFactory;
class CdiExtensionIntegrationTests {
private static SeContainer container;
private static Logger LOGGER = LoggerFactory.getLogger(CdiExtensionIntegrationTests.class);
private static Log LOGGER = LogFactory.getLog(CdiExtensionIntegrationTests.class);
@BeforeAll
static void setUp() {

View File

@@ -15,8 +15,8 @@
*/
package org.springframework.data.jpa.repository.sample;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.jpa.domain.sample.User;
import org.springframework.data.jpa.repository.JpaContext;
@@ -29,7 +29,7 @@ import org.springframework.util.Assert;
*/
public class UserRepositoryImpl implements UserRepositoryCustom {
private static final Logger LOG = LoggerFactory.getLogger(UserRepositoryImpl.class);
private static final Log LOG = LogFactory.getLog(UserRepositoryImpl.class);
@Autowired
public UserRepositoryImpl(JpaContext context) {