make sure debug really is debug by initialising before DefaultMaven gets looked up.

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@168635 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2005-05-06 18:56:34 +00:00
parent ef7d9ec2bd
commit b90399de88
1 changed files with 10 additions and 10 deletions
maven-core/src/main/java/org/apache/maven/cli

View File

@ -40,7 +40,6 @@ import org.apache.maven.monitor.logging.DefaultLog;
import org.apache.maven.plugin.Mojo;
import org.apache.maven.reactor.ReactorException;
import org.apache.maven.settings.MavenSettingsBuilder;
import org.apache.maven.settings.Profile;
import org.apache.maven.settings.Settings;
import org.codehaus.classworlds.ClassWorld;
import org.codehaus.plexus.PlexusContainerException;
@ -192,9 +191,16 @@ public class MavenCli
MavenExecutionRequest request = null;
try
{
maven = createMavenInstance( embedder );
// logger must be created first
LoggerManager manager = (LoggerManager) embedder.lookup( LoggerManager.ROLE );
if ( debug )
{
manager.setThreshold( Logger.LEVEL_DEBUG );
}
request = createRequest( projectFiles, embedder, commandLine, settings, eventDispatcher, debug );
request = createRequest( projectFiles, embedder, commandLine, settings, eventDispatcher, manager );
maven = createMavenInstance( embedder );
}
catch ( ComponentLookupException e )
{
@ -247,7 +253,7 @@ public class MavenCli
private static MavenExecutionRequest createRequest( List files, ArtifactEnabledEmbedder embedder,
CommandLine commandLine, Settings settings,
EventDispatcher eventDispatcher, boolean debug )
EventDispatcher eventDispatcher, LoggerManager manager )
throws ComponentLookupException
{
MavenExecutionRequest request = null;
@ -257,12 +263,6 @@ public class MavenCli
request = new DefaultMavenExecutionRequest( localRepository, settings, eventDispatcher,
commandLine.getArgList(), files, userDir.getPath() );
LoggerManager manager = (LoggerManager) embedder.lookup( LoggerManager.ROLE );
if ( debug )
{
manager.setThreshold( Logger.LEVEL_DEBUG );
}
// TODO [BP]: do we set one per mojo? where to do it?
Logger logger = manager.getLoggerForComponent( Mojo.ROLE );
if ( logger != null )