#147 - Polishing.
Improve logger formatting to easier distinguish between log messages indicating Maven start and success. Avoid duplicate logging of exceptions.
This commit is contained in:
@@ -30,7 +30,7 @@ import org.springframework.util.ReflectionUtils;
|
||||
/**
|
||||
* Extension of {@link JLineShellComponent} to customize the {@link ExecutionStrategy} to one that can deal with package
|
||||
* protected command classes.
|
||||
*
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @see https://github.com/spring-projects/spring-shell/pull/93
|
||||
*/
|
||||
@@ -38,7 +38,7 @@ class CustomShellComponent extends JLineShellComponent {
|
||||
|
||||
private final ExecutionStrategy executionStrategy = new CustomExecutionStrategy();
|
||||
|
||||
/*
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.shell.core.JLineShellComponent#getExecutionStrategy()
|
||||
*/
|
||||
@@ -88,7 +88,7 @@ class CustomShellComponent extends JLineShellComponent {
|
||||
ReflectionUtils.makeAccessible(method);
|
||||
return ReflectionUtils.invokeMethod(method, parseResult.getInstance(), parseResult.getArguments());
|
||||
} catch (Throwable th) {
|
||||
logger.severe("Command failed " + th);
|
||||
logger.severe("Command failed");
|
||||
return handleThrowable(th);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -351,7 +351,7 @@ class MavenBuildSystem implements BuildSystem {
|
||||
|
||||
Gpg gpg = this.gpg.isGpgAvailable() ? this.gpg : properties.getGpg();
|
||||
|
||||
CommandLine arguments = CommandLine.of(Goal.DEPLOY, //
|
||||
CommandLine arguments = CommandLine.of(Goal.CLEAN, Goal.DEPLOY, //
|
||||
profile("ci,release,central"), //
|
||||
SKIP_TESTS, //
|
||||
arg("gpg.executable").withValue(gpg.getExecutable()), //
|
||||
|
||||
@@ -69,7 +69,7 @@ class MavenRuntime {
|
||||
|
||||
public void execute(Project project, CommandLine arguments) {
|
||||
|
||||
logger.log(project, "Executing mvn %s", arguments.toString());
|
||||
logger.log(project, "📦 Executing mvn %s", arguments.toString());
|
||||
|
||||
try (MavenLogger mavenLogger = getLogger(project, arguments.getGoals())) {
|
||||
|
||||
@@ -94,11 +94,12 @@ class MavenRuntime {
|
||||
InvocationResult result = invoker.execute(request);
|
||||
|
||||
if (result.getExitCode() != 0) {
|
||||
logger.warn(project, "Failed execution mvn %s", arguments.toString());
|
||||
logger.warn(project, "🙈 Failed execution mvn %s", arguments.toString());
|
||||
|
||||
throw new IllegalStateException("Failed execution mvn " + arguments.toString(), result.getExecutionException());
|
||||
throw new IllegalStateException("🙈 Failed execution mvn " + arguments.toString(),
|
||||
result.getExecutionException());
|
||||
}
|
||||
logger.log(project, "Successful execution mvn %s", arguments.toString());
|
||||
logger.log(project, "🆗 Successful execution mvn %s", arguments.toString());
|
||||
} catch (Exception e) {
|
||||
if (e instanceof RuntimeException) {
|
||||
throw (RuntimeException) e;
|
||||
|
||||
@@ -23,14 +23,16 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collector;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
||||
import org.springframework.data.release.model.ModuleIteration;
|
||||
import org.springframework.data.release.model.Tracker;
|
||||
import org.springframework.data.release.model.TrainIteration;
|
||||
import org.springframework.data.release.utils.ListWrapperCollector;
|
||||
import org.springframework.data.util.Streamable;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Value object to represent a list of {@link Ticket}s.
|
||||
@@ -100,8 +102,8 @@ public class Tickets implements Streamable<Ticket> {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
builder.append(String.format("Train only tickets: %s of %s", tickets.size(), overallTotal));
|
||||
builder.append("\n");
|
||||
builder.append(StringUtils.collectionToDelimitedString(tickets, "\n"));
|
||||
builder.append(IOUtils.LINE_SEPARATOR);
|
||||
builder.append(tickets.stream().map(it -> "\t" + it).collect(Collectors.joining(IOUtils.LINE_SEPARATOR)));
|
||||
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ import org.springframework.stereotype.Component;
|
||||
@Component
|
||||
public class Logger {
|
||||
|
||||
private static final String PREFIX_TEMPLATE = "%s > %s";
|
||||
private static final String PREFIX_TEMPLATE = "%-14s > %s";
|
||||
|
||||
private final java.util.logging.Logger LOGGER = HandlerUtils.getLogger(getClass());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user