From ea76d81630150aaa03aeccfc4ae30866910f6b57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Basl=C3=A9?= Date: Fri, 21 Feb 2020 20:17:18 +0100 Subject: [PATCH] fix #185 Redirect commands stdout/stderr to `releaser.commands` logger This allows configuration of that specific logger to append only to eg. a File instead of polluting the main application log. --- .../releaser/internal/project/ProjectCommandExecutor.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/releaser-core/src/main/java/releaser/internal/project/ProjectCommandExecutor.java b/releaser-core/src/main/java/releaser/internal/project/ProjectCommandExecutor.java index 7602e57b..a0f2d229 100644 --- a/releaser-core/src/main/java/releaser/internal/project/ProjectCommandExecutor.java +++ b/releaser-core/src/main/java/releaser/internal/project/ProjectCommandExecutor.java @@ -325,8 +325,12 @@ class ReleaserProcessExecutor { log.info("Will run the command [{}]", Arrays.toString(commandsToRun)); return new ProcessExecutor().command(commandsToRun).destroyOnExit() .readOutput(true) - .redirectOutputAlsoTo( - Slf4jStream.of(ReleaserProcessExecutor.class).asInfo()) + // releaser.commands logger should be configured to redirect + // only to a file (with additivity=false). ideally the root logger should + // append to same file on top of whatever root appender, so that file + // contains the most output + .redirectOutputAlsoTo(Slf4jStream.of("releaser.commands").asInfo()) + .redirectErrorAlsoTo(Slf4jStream.of("releaser.commands").asWarn()) .directory(new File(workingDir)); }