[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
This commit is contained in:
Hervé Boutemy 2012-12-01 09:35:12 +01:00
parent aebb647020
commit 1062524b39
3 changed files with 18 additions and 4 deletions

View File

@ -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 )

View File

@ -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 )

View File

@ -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;