This commit is contained in:
Phillip Webb 2019-10-22 13:12:09 -07:00
parent 89d903d89a
commit 714c9b9804
4 changed files with 10 additions and 18 deletions

View File

@ -51,6 +51,7 @@ import org.springframework.boot.CommandLineRunner;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.ApplicationEventPublisherAware;
import org.springframework.core.Ordered;
import org.springframework.core.log.LogMessage;
import org.springframework.util.Assert;
import org.springframework.util.PatternMatchUtils;
import org.springframework.util.StringUtils;
@ -158,9 +159,7 @@ public class JobLauncherCommandLineRunner implements CommandLineRunner, Ordered,
if (StringUtils.hasText(this.jobNames)) {
String[] jobsToRun = this.jobNames.split(",");
if (!PatternMatchUtils.simpleMatch(jobsToRun, job.getName())) {
if (logger.isDebugEnabled()) {
logger.debug("Skipped job: " + job.getName());
}
logger.debug(LogMessage.format("Skipped job: %s", job.getName()));
continue;
}
}
@ -180,9 +179,7 @@ public class JobLauncherCommandLineRunner implements CommandLineRunner, Ordered,
execute(job, jobParameters);
}
catch (NoSuchJobException ex) {
if (logger.isDebugEnabled()) {
logger.debug("No job found in registry for job name: " + jobName);
}
logger.debug(LogMessage.format("No job found in registry for job name: %s", jobName));
}
}
}

View File

@ -29,6 +29,7 @@ import java.util.regex.Pattern;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.core.log.LogMessage;
import org.springframework.util.Base64Utils;
/**
@ -68,9 +69,7 @@ class Connection {
this.inputStream = new ConnectionInputStream(inputStream);
this.outputStream = new ConnectionOutputStream(outputStream);
this.header = this.inputStream.readHeader();
if (logger.isDebugEnabled()) {
logger.debug("Established livereload connection [" + this.header + "]");
}
logger.debug(LogMessage.format("Established livereload connection [%s]", this.header));
}
/**
@ -109,9 +108,7 @@ class Connection {
throw new ConnectionClosedException();
}
else if (frame.getType() == Frame.Type.TEXT) {
if (logger.isDebugEnabled()) {
logger.debug("Received LiveReload text frame " + frame);
}
logger.debug(LogMessage.format("Received LiveReload text frame %s", frame));
}
else {
throw new IOException("Unexpected Frame Type " + frame.getType());

View File

@ -33,6 +33,7 @@ import java.util.concurrent.atomic.AtomicInteger;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.core.log.LogMessage;
import org.springframework.util.Assert;
/**
@ -109,9 +110,7 @@ public class LiveReloadServer {
public int start() throws IOException {
synchronized (this.monitor) {
Assert.state(!isStarted(), "Server already started");
if (logger.isDebugEnabled()) {
logger.debug("Starting live reload server on port " + this.port);
}
logger.debug(LogMessage.format("Starting live reload server on port %s", this.port));
this.serverSocket = new ServerSocket(this.port);
int localPort = this.serverSocket.getLocalPort();
this.listenThread = this.threadFactory.newThread(this::acceptConnections);

View File

@ -30,6 +30,7 @@ import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.EnvironmentAware;
import org.springframework.core.annotation.AnnotationAwareOrderComparator;
import org.springframework.core.io.support.SpringFactoriesLoader;
import org.springframework.core.log.LogMessage;
import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;
import org.springframework.util.ReflectionUtils;
@ -113,9 +114,7 @@ final class FailureAnalyzers implements SpringBootExceptionReporter {
}
}
catch (Throwable ex) {
if (logger.isDebugEnabled()) {
logger.debug("FailureAnalyzer " + analyzer + " failed", ex);
}
logger.debug(LogMessage.format("FailureAnalyzer %s failed", analyzer), ex);
}
}
return null;