maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aherit...@apache.org
Subject [3/50] git commit: [MNG-5396] changed logger name for execution events and batch transfer (was MavenCli)
Date Sat, 01 Dec 2012 14:50:01 GMT
[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/81e0d1f4
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/81e0d1f4
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/81e0d1f4

Branch: refs/heads/feature/colorized-console/log4j2
Commit: 81e0d1f415dd800f98af422af6a8ab35cc96584d
Parents: 86f8e0e
Author: Hervé Boutemy <hboutemy@apache.org>
Authored: Sat Dec 1 09:35:12 2012 +0100
Committer: Arnaud Héritier <aheritier@exoplatform.com>
Committed: Sat Dec 1 13:53:43 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/81e0d1f4/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 61ffed8..a342944 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
@@ -898,7 +898,7 @@ public class MavenCli
             transferListener = getBatchTransferListener();
         }
 
-        ExecutionListener executionListener = new ExecutionEventLogger( slf4jLogger );
+        ExecutionListener executionListener = new ExecutionEventLogger();
         executionListener = eventSpyDispatcher.chainListener( executionListener );
 
         String alternatePomFile = null;
@@ -1164,7 +1164,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/81e0d1f4/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/81e0d1f4/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