PR: MNG-828

log parameters to mojo in debug mode


git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@307267 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2005-10-08 06:36:17 +00:00
parent b926e6ff11
commit ae893b5055
3 changed files with 60 additions and 2 deletions

View File

@ -0,0 +1,53 @@
package org.apache.maven.plugin;
/*
* Copyright 2001-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import org.codehaus.plexus.component.configurator.ConfigurationListener;
import org.codehaus.plexus.logging.Logger;
/**
* Log at debug level the mojo configuration.
*
* @author <a href="mailto:brett@apache.org">Brett Porter</a>
* @version $Id$
*/
public class DebugConfigurationListener
implements ConfigurationListener
{
private Logger logger;
public DebugConfigurationListener( Logger logger )
{
this.logger = logger;
}
public void notifyFieldChangeUsingSetter( String fieldName, Object value, Object target )
{
if ( logger.isDebugEnabled() )
{
logger.debug( " (s) " + fieldName + " = " + value );
}
}
public void notifyFieldChangeUsingReflection( String fieldName, Object value, Object target )
{
if ( logger.isDebugEnabled() )
{
logger.debug( " (f) " + fieldName + " = " + value );
}
}
}

View File

@ -58,6 +58,7 @@ import org.codehaus.plexus.PlexusContainer;
import org.codehaus.plexus.PlexusContainerException;
import org.codehaus.plexus.component.configurator.ComponentConfigurationException;
import org.codehaus.plexus.component.configurator.ComponentConfigurator;
import org.codehaus.plexus.component.configurator.ConfigurationListener;
import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException;
import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator;
import org.codehaus.plexus.component.repository.exception.ComponentLifecycleException;
@ -1036,8 +1037,12 @@ public class DefaultPluginManager
configurator = (ComponentConfigurator) pluginContainer.lookup( ComponentConfigurator.ROLE );
}
ConfigurationListener listener = new DebugConfigurationListener( getLogger() );
getLogger().debug( "Configuring mojo '" + mojoDescriptor.getId() + "' -->" );
configurator.configureComponent( plugin, configuration, expressionEvaluator,
pluginContainer.getContainerRealm() );
pluginContainer.getContainerRealm(), listener );
getLogger().debug( "-- end configuration --" );
}
catch ( ComponentConfigurationException e )
{

View File

@ -203,7 +203,7 @@
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-container-default</artifactId>
<version>1.0-alpha-7</version>
<version>1.0-alpha-8-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>plexus</groupId>