Tweak logging pattern to a compact representation.
Add project name to Maven logger.
This commit is contained in:
@@ -28,16 +28,17 @@ import org.springframework.data.release.io.OsOperations;
|
|||||||
import org.springframework.data.release.io.Workspace;
|
import org.springframework.data.release.io.Workspace;
|
||||||
import org.springframework.data.release.model.Project;
|
import org.springframework.data.release.model.Project;
|
||||||
import org.springframework.data.release.utils.Logger;
|
import org.springframework.data.release.utils.Logger;
|
||||||
|
import org.springframework.shell.support.util.StringUtils;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Oliver Gierke
|
* @author Oliver Gierke
|
||||||
|
* @author Mark Paluch
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Component
|
@Component
|
||||||
class MavenRuntime {
|
class MavenRuntime {
|
||||||
|
|
||||||
private final Invoker invoker;
|
|
||||||
private final Workspace workspace;
|
private final Workspace workspace;
|
||||||
private final OsOperations os;
|
private final OsOperations os;
|
||||||
private final Logger logger;
|
private final Logger logger;
|
||||||
@@ -45,7 +46,7 @@ class MavenRuntime {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new {@link MavenRuntime} for the given {@link Workspace} and Maven home.
|
* Creates a new {@link MavenRuntime} for the given {@link Workspace} and Maven home.
|
||||||
*
|
*
|
||||||
* @param workspace must not be {@literal null}.
|
* @param workspace must not be {@literal null}.
|
||||||
* @param os must not be {@literal null}.
|
* @param os must not be {@literal null}.
|
||||||
* @param logger must not be {@literal null}.
|
* @param logger must not be {@literal null}.
|
||||||
@@ -57,20 +58,21 @@ class MavenRuntime {
|
|||||||
this.os = os;
|
this.os = os;
|
||||||
this.logger = logger;
|
this.logger = logger;
|
||||||
this.properties = properties;
|
this.properties = properties;
|
||||||
|
}
|
||||||
|
|
||||||
this.invoker = new DefaultInvoker();
|
public void execute(Project project, CommandLine arguments) {
|
||||||
this.invoker.setMavenHome(properties.getMavenHome());
|
|
||||||
this.invoker.setOutputHandler(line -> log.info(line));
|
String logPrefix = StringUtils.padRight(project.getName(), 10);
|
||||||
this.invoker.setErrorHandler(line -> log.info(line));
|
Invoker invoker = new DefaultInvoker();
|
||||||
|
invoker.setMavenHome(properties.getMavenHome());
|
||||||
|
invoker.setOutputHandler(line -> log.info(logPrefix + ": " + line));
|
||||||
|
invoker.setErrorHandler(line -> log.warn(logPrefix + ": " + line));
|
||||||
|
|
||||||
File localRepository = properties.getLocalRepository();
|
File localRepository = properties.getLocalRepository();
|
||||||
|
|
||||||
if (localRepository != null) {
|
if (localRepository != null) {
|
||||||
this.invoker.setLocalRepositoryDirectory(localRepository);
|
invoker.setLocalRepositoryDirectory(localRepository);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public void execute(Project project, CommandLine arguments) {
|
|
||||||
|
|
||||||
DefaultInvocationRequest request = new DefaultInvocationRequest();
|
DefaultInvocationRequest request = new DefaultInvocationRequest();
|
||||||
request.setJavaHome(os.getJavaHome());
|
request.setJavaHome(os.getJavaHome());
|
||||||
|
|||||||
@@ -18,4 +18,5 @@ deployment.gpg.executable=/usr/local/bin/gpg2
|
|||||||
jira.api-url=https://jira.spring.io
|
jira.api-url=https://jira.spring.io
|
||||||
|
|
||||||
# GitHub
|
# GitHub
|
||||||
github.api-url=https://api.github.com
|
github.api-url=https://api.github.com
|
||||||
|
logging.pattern.console=%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(%5p) %clr(%-20.20logger{19}){cyan}%clr(:){faint} %m%n%wEx
|
||||||
|
|||||||
Reference in New Issue
Block a user