mirror of https://github.com/apache/maven.git
[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:
parent
aebb647020
commit
1062524b39
|
@ -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 )
|
||||
|
|
|
@ -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 )
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue