DATACMNS-1755 - Consistently use commons-logging.

Replace the few occurrences where SLF4J was being used directly so that
all logging now happens via commons-logging. The log patterns used in
SLF4J messages have been replaced with `LogMessage` which was introduced
in Spring Framework 5.2.

Original pull request: #448.
This commit is contained in:
Phillip Webb
2020-06-09 11:13:27 -07:00
committed by Mark Paluch
parent b225acd22d
commit 67442077b7
15 changed files with 86 additions and 65 deletions

View File

@@ -18,11 +18,12 @@ package org.springframework.data.auditing;
import java.time.temporal.TemporalAccessor;
import java.util.Optional;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.joda.time.DateTime;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.aop.support.AopUtils;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.core.log.LogMessage;
import org.springframework.data.domain.Auditable;
import org.springframework.data.domain.AuditorAware;
import org.springframework.data.mapping.PersistentEntity;
@@ -40,7 +41,7 @@ import org.springframework.util.Assert;
*/
public class AuditingHandler implements InitializingBean {
private static final Logger logger = LoggerFactory.getLogger(AuditingHandler.class);
private static final Log logger = LogFactory.getLog(AuditingHandler.class);
private final DefaultAuditableBeanWrapperFactory factory;
@@ -170,7 +171,7 @@ public class AuditingHandler implements InitializingBean {
Object defaultedNow = now.map(Object::toString).orElse("not set");
Object defaultedAuditor = auditor.map(Object::toString).orElse("unknown");
logger.debug("Touched {} - Last modification at {} by {}", target, defaultedNow, defaultedAuditor);
logger.debug(LogMessage.format("Touched %s - Last modification at %s by %s", target, defaultedNow, defaultedAuditor));
}
return it.getBean();