maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hbout...@apache.org
Subject git commit: [MNG-5396] changed logger name for execution events and batch transfer (was MavenCli)
Date Sat, 01 Dec 2012 08:35:19 GMT
Updated Branches:
  refs/heads/master aebb64702 -> 1062524b3


[MNG-5396] changed logger name for execution events and batch transfer
(was MavenCli)

this shows some logging patterns we should discuss about and document
our conventions

Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/1062524b
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/1062524b
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/1062524b

Branch: refs/heads/master
Commit: 1062524b39952e040b2fe7f0073ce4c4d3a00630
Parents: aebb647
Author: Hervé Boutemy <hboutemy@apache.org>
Authored: Sat Dec 1 09:35:12 2012 +0100
Committer: Hervé Boutemy <hboutemy@apache.org>
Committed: Sat Dec 1 09:35:12 2012 +0100

----------------------------------------------------------------------
 .../main/java/org/apache/maven/cli/MavenCli.java   |    4 ++--
 .../maven/cli/event/ExecutionEventLogger.java      |    9 ++++++++-
 .../cli/transfer/Slf4jMavenTransferListener.java   |    9 ++++++++-
 3 files changed, 18 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/1062524b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
----------------------------------------------------------------------
diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
index 0ba7d6b..81d520b 100644
--- a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
+++ b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
@@ -894,7 +894,7 @@ public class MavenCli
             transferListener = getBatchTransferListener();
         }
 
-        ExecutionListener executionListener = new ExecutionEventLogger( slf4jLogger );
+        ExecutionListener executionListener = new ExecutionEventLogger();
         executionListener = eventSpyDispatcher.chainListener( executionListener );
 
         String alternatePomFile = null;
@@ -1160,7 +1160,7 @@ public class MavenCli
     
     protected TransferListener getBatchTransferListener()
     {
-        return new Slf4jMavenTransferListener( slf4jLogger );
+        return new Slf4jMavenTransferListener();
     }
     
     protected void customizeContainer( PlexusContainer container )

http://git-wip-us.apache.org/repos/asf/maven/blob/1062524b/maven-embedder/src/main/java/org/apache/maven/cli/event/ExecutionEventLogger.java
----------------------------------------------------------------------
diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/event/ExecutionEventLogger.java
b/maven-embedder/src/main/java/org/apache/maven/cli/event/ExecutionEventLogger.java
index 819f179..f55141d 100644
--- a/maven-embedder/src/main/java/org/apache/maven/cli/event/ExecutionEventLogger.java
+++ b/maven-embedder/src/main/java/org/apache/maven/cli/event/ExecutionEventLogger.java
@@ -31,9 +31,10 @@ import org.apache.maven.execution.MavenSession;
 import org.apache.maven.plugin.MojoExecution;
 import org.apache.maven.project.MavenProject;
 import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
- * Logs execution events to a user-supplied logger.
+ * Logs execution events to logger, eventually user-supplied.
  *
  * @author Benjamin Bentmann
  */
@@ -44,6 +45,12 @@ public class ExecutionEventLogger
 
     private static final int LINE_LENGTH = 72;
 
+    public ExecutionEventLogger()
+    {
+        logger = LoggerFactory.getLogger( ExecutionEventLogger.class );
+    }
+
+    // TODO should we deprecate?
     public ExecutionEventLogger( Logger logger )
     {
         if ( logger == null )

http://git-wip-us.apache.org/repos/asf/maven/blob/1062524b/maven-embedder/src/main/java/org/apache/maven/cli/transfer/Slf4jMavenTransferListener.java
----------------------------------------------------------------------
diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/transfer/Slf4jMavenTransferListener.java
b/maven-embedder/src/main/java/org/apache/maven/cli/transfer/Slf4jMavenTransferListener.java
index 27ff90d..f09c768 100644
--- a/maven-embedder/src/main/java/org/apache/maven/cli/transfer/Slf4jMavenTransferListener.java
+++ b/maven-embedder/src/main/java/org/apache/maven/cli/transfer/Slf4jMavenTransferListener.java
@@ -24,6 +24,7 @@ import java.text.DecimalFormatSymbols;
 import java.util.Locale;
 
 import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.sonatype.aether.transfer.AbstractTransferListener;
 import org.sonatype.aether.transfer.TransferCancelledException;
 import org.sonatype.aether.transfer.TransferEvent;
@@ -33,8 +34,14 @@ public class Slf4jMavenTransferListener
     extends AbstractTransferListener
 {
 
-    protected Logger out;
+    protected final Logger out;
 
+    public Slf4jMavenTransferListener()
+    {
+        this.out = LoggerFactory.getLogger( Slf4jMavenTransferListener.class );
+    }
+
+    // TODO should we deprecate?
     public Slf4jMavenTransferListener( Logger out )
     {
         this.out = out;


Mime
View raw message