aboutsummaryrefslogtreecommitdiffstats
path: root/vespa-maven-plugin
diff options
context:
space:
mode:
authorJon Marius Venstad <venstad@gmail.com>2019-09-16 11:39:31 +0200
committerJon Marius Venstad <venstad@gmail.com>2019-09-16 11:39:31 +0200
commit6db8c233ee263aeee6e554ecd48d37a87f2a7a56 (patch)
tree70c9af1bd79ac7828aab8793ea42304927d1004f /vespa-maven-plugin
parentf1112fbe19617a6d422292cbe808b3b2268fed65 (diff)
Use separate setting for Vespa log levels in deploy mojo
Diffstat (limited to 'vespa-maven-plugin')
-rw-r--r--vespa-maven-plugin/src/main/java/ai/vespa/hosted/plugin/DeployMojo.java18
1 files changed, 12 insertions, 6 deletions
diff --git a/vespa-maven-plugin/src/main/java/ai/vespa/hosted/plugin/DeployMojo.java b/vespa-maven-plugin/src/main/java/ai/vespa/hosted/plugin/DeployMojo.java
index 74e13066964..e2d10316a21 100644
--- a/vespa-maven-plugin/src/main/java/ai/vespa/hosted/plugin/DeployMojo.java
+++ b/vespa-maven-plugin/src/main/java/ai/vespa/hosted/plugin/DeployMojo.java
@@ -31,8 +31,13 @@ public class DeployMojo extends AbstractVespaDeploymentMojo {
@Parameter(property = "follow", defaultValue = "true")
private boolean follow;
+ @Parameter(property = "vespaLogLevel", defaultValue = "error")
+ private String vespaLogLevel;
+ private DeploymentLog.Level loggable;
+
@Override
protected void doExecute() throws MojoFailureException, MojoExecutionException {
+ loggable = DeploymentLog.Level.valueOf(vespaLogLevel);
Deployment deployment = Deployment.ofPackage(Paths.get(firstNonBlank(applicationZip,
projectPathOf("target", "application.zip"))));
if (vespaVersion != null) deployment = deployment.atVersion(vespaVersion);
@@ -84,12 +89,13 @@ public class DeployMojo extends AbstractVespaDeploymentMojo {
String timestamp = formatter.format(entry.at());
String message = String.join(padding, entry.message().split("\n"))
.replaceAll("\\s*\n", "\n").trim();
- switch (entry.level()) {
- case "error" : getLog().error(" [" + timestamp + "] " + message); break;
- case "warning" : getLog().warn (" [" + timestamp + "] " + message); break;
- case "info" : getLog().info(" [" + timestamp + "] " + message); break;
- default : getLog().debug(" [" + timestamp + "] " + message); break;
- }
+ if ( ! entry.isVespaLogEntry() || loggable.compareTo(entry.level()) <= 0)
+ switch (entry.level()) {
+ case error : getLog().error(" [" + timestamp + "] " + message); break;
+ case warning : getLog().warn (" [" + timestamp + "] " + message); break;
+ case info : getLog().info(" [" + timestamp + "] " + message); break;
+ default : getLog().debug(" [" + timestamp + "] " + message); break;
+ }
}
}