Pankraz76 commented on code in PR #2456:
URL: https://github.com/apache/maven/pull/2456#discussion_r2134663166


##########
impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/LookupInvoker.java:
##########
@@ -396,56 +399,41 @@ protected Consumer<String> determineWriter(C context) {
     protected Consumer<String> doDetermineWriter(C context) {
         Options options = context.invokerRequest.options();
         if (options.logFile().isPresent()) {
-            Path logFile = context.cwd.resolve(options.logFile().get());
             try {
-                PrintWriter printWriter = new 
PrintWriter(Files.newBufferedWriter(logFile), true);
+                PrintWriter printWriter = new 
PrintWriter(newBufferedWriter(context.cwd.resolve(options.logFile().get())), 
true);
                 context.closeables.add(printWriter);
                 return printWriter::println;
             } catch (IOException e) {
-                throw new MavenException("Unable to redirect logging to " + 
logFile, e);
+                throw new MavenException(e);
             }
         } else {
             // Given the terminal creation has been offloaded to a different 
thread,
-            // do not pass directly the terminal writer
-            return msg -> {
-                PrintWriter pw = context.terminal.writer();
-                pw.println(msg);
-                pw.flush();
-            };
+            // do not directly pass the terminal writer.
+            return msg -> context.terminal.writer().println(msg);
         }
     }
 
-    protected void activateLogging(C context) throws Exception {
-        InvokerRequest invokerRequest = context.invokerRequest;
-        Options mavenOptions = invokerRequest.options();
-
+    protected void activateLogging(C context) {
         context.slf4jConfiguration.activate();
-        if (mavenOptions.failOnSeverity().isPresent()) {

Review Comment:
   i generally dont really read the code (in detail), as its all about random 
impl. details.
   
   im only care about the patterns restoring their balance.
   
   its all there, just needs a little fashion makeover to get the newest look.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to