org.codehaus.plexus.logging.Logger类的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(11.4k)|赞(0)|评价(0)|浏览(178)

本文整理了Java中org.codehaus.plexus.logging.Logger类的一些代码示例,展示了Logger类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Logger类的具体详情如下:
包路径:org.codehaus.plexus.logging.Logger
类名称:Logger

Logger介绍

暂无

代码示例

代码示例来源:origin: apache/maven

private String getMavenVersion()
{
  Properties props = new Properties();
  try ( InputStream is = getClass().getResourceAsStream(
    "/META-INF/maven/org.apache.maven/maven-core/pom.properties" ) )
  {
    if ( is != null )
    {
      props.load( is );
    }
  }
  catch ( IOException e )
  {
    logger.debug( "Failed to read Maven version", e );
  }
  return props.getProperty( "version", "unknown-version" );
}

代码示例来源:origin: org.apache.maven/maven-plugin-api

public void info( Throwable error )
{
  logger.info( "", error );
}

代码示例来源:origin: apache/maven

Properties props = new Properties();
    props.load( is );
    logger.warn(
      "Could not locate " + resource + " on classpath, Maven runtime information not available" );
  if ( logger.isDebugEnabled() )
    logger.warn( msg, e );
    logger.warn( msg );
String version = props.getProperty( "version", "" ).trim();

代码示例来源:origin: apache/maven

private void logError( String action, Throwable e, EventSpy spy )
{
  String msg = "Failed to " + action + " spy " + spy.getClass().getName() + ": " + e.getMessage();
  if ( logger.isDebugEnabled() )
  {
    logger.warn( msg, e );
  }
  else
  {
    logger.warn( msg );
  }
}

代码示例来源:origin: apache/maven

public void notifyFieldChangeUsingSetter( String fieldName, Object value, Object target )
{
  if ( logger.isDebugEnabled() )
  {
    logger.debug( "  (s) " + fieldName + " = " + toString( value ) );
  }
}

代码示例来源:origin: apache/maven

public void updateScopeCurrentPom( Artifact artifact, String ignoredScope )
{
  logger.debug( indent + artifact + " (not setting artifactScope to: " + ignoredScope + "; local artifactScope "
    + artifact.getScope() + " wins)" );
  // TODO better way than static? this might hide messages in a reactor
  if ( !ignoredArtifacts.contains( artifact ) )
  {
    logger.warn( "\n\tArtifact " + artifact + " retains local artifactScope '" + artifact.getScope()
      + "' overriding broader artifactScope '" + ignoredScope + "'\n"
      + "\tgiven by a dependency. If this is not intended, modify or remove the local artifactScope.\n" );
    ignoredArtifacts.add( artifact );
  }
}

代码示例来源:origin: apache/maven

getLogger().debug( "Failed to create directory: " + touchfile.getParent()
              + " for tracking artifact metadata resolution." );
  return;
try
  Properties props = new Properties();
    getLogger().debug( "Reading resolution-state from: " + touchfile );
    props.load( Channels.newInputStream( channel ) );
  props.setProperty( key, Long.toString( System.currentTimeMillis() ) );
  getLogger().debug( "Writing resolution-state to: " + touchfile );
  channel.truncate( 0 );
  props.store( Channels.newOutputStream( channel ), "Last modified on: " + new Date() );
  getLogger().debug(
    "Failed to record lastUpdated information for resolution.\nFile: " + touchfile.toString()
      + "; key: " + key, e );
      getLogger().debug( "Error releasing exclusive lock for resolution tracking file: " + touchfile,
                e );
      getLogger().debug( "Error closing FileChannel for resolution tracking file: " + touchfile, e );

代码示例来源:origin: apache/maven

getLogger().debug( "Skipped unreadable resolution tracking file " + touchfile );
return null;
  Properties props = new Properties();
  getLogger().debug( "Reading resolution-state from: " + touchfile );
  props.load( in );
  getLogger().debug( "Failed to read resolution tracking file " + touchfile, e );
      getLogger().debug( "Error releasing shared lock for resolution tracking file: " + touchfile,
                e );
      getLogger().debug( "Error closing FileChannel for resolution tracking file: " + touchfile, e );

代码示例来源:origin: apache/maven

Properties headers = new Properties();
    headers.put( "User-Agent", ConfigUtils.getString( legacySupport.getRepositorySession(), "Maven",
                             ConfigurationProperties.USER_AGENT ) );
    try
      logger.debug( "Could not set user agent for wagon " + wagon.getClass().getName() + ": " + e );
if ( repository.getProxy() != null && logger.isDebugEnabled() )
  logger.debug( "Using proxy " + repository.getProxy().getHost() + ":" + repository.getProxy().getPort()
           + " for " + repository.getUrl() );

代码示例来源:origin: org.sonatype.maven.archetype/archetype-common

public void updateLocalCatalog(org.apache.maven.archetype.catalog.Archetype archetype, String path) {
    log.debug("Updating local catalog; archetype: " + archetype + ", path: " + path);

    try {
      Properties properties = new Properties();
      properties.setProperty("file", path);
      ArchetypeDataSource source = archetypeSources.get("catalog");
      assert source != null;

      source.updateCatalog(properties, archetype);
    }
    catch (ArchetypeDataSourceException e) {}
  }
}

代码示例来源:origin: org.apache.maven/maven-project

Properties systemProperties = new Properties( System.getProperties() );
if ( requestProperties != null )
  systemProperties.putAll( requestProperties );
      container.getLogger().debug( "Error releasing profile activators - ignoring.", e );

代码示例来源:origin: apache/maven

Date readLastUpdated( File touchfile, String key )
{
  getLogger().debug( "Searching for " + key + " in resolution tracking file." );
  Properties props = read( touchfile );
  if ( props != null )
  {
    String rawVal = props.getProperty( key );
    if ( rawVal != null )
    {
      try
      {
        return new Date( Long.parseLong( rawVal ) );
      }
      catch ( NumberFormatException e )
      {
        getLogger().debug( "Cannot parse lastUpdated date: \'" + rawVal + "\'. Ignoring.", e );
      }
    }
  }
  return null;
}

代码示例来源:origin: org.sonatype.maven.archetype/archetype-common

private void restoreCommandLineProperties(ArchetypeConfiguration archetypeConfiguration, Properties executionProperties) {
  log.debug("Restoring command line properties");
  Iterator properties = archetypeConfiguration.getRequiredProperties().iterator();
  while (properties.hasNext()) {
    String property = (String) properties.next();
    if (executionProperties.containsKey(property)) {
      archetypeConfiguration.setProperty(property, executionProperties.getProperty(property));
      log.debug("Restored " + property + "=" + archetypeConfiguration.getProperty(property));
    }
  }
}

代码示例来源:origin: org.apache.maven/maven-project

if ( Artifact.SCOPE_SYSTEM.equals( artifact.getScope() ) )
      warnedPoms.add( pomArtifact.getId() );
      getLogger().warn( "POM for \'"
                 + pomArtifact
                 + "\' is invalid.\n\nIts dependencies (if any) will NOT be available to the current build." );
      if ( getLogger().isDebugEnabled() )
        getLogger().debug( "Reason: " + e.getMessage() );
          getLogger().debug( "\nValidation Errors:" );
          for ( Iterator i = validationResult.getMessages().iterator(); i.hasNext(); )
            getLogger().debug( i.next().toString() );
          getLogger().debug( "\n" );
      if ( artifact.getDependencyTrail() != null && artifact.getDependencyTrail().size() == 1 )
        getLogger().warn( "While downloading " + pomArtifact.getGroupId() + ":" +
          pomArtifact.getArtifactId() + ":" + pomArtifact.getVersion() + message + "\n" );
        getLogger().debug( "While downloading " + pomArtifact.getGroupId() + ":" +
          pomArtifact.getArtifactId() + ":" + pomArtifact.getVersion() + message + "\n" );

代码示例来源:origin: org.apache.maven/maven-project

if ( getLogger().isDebugEnabled() )
  getLogger().debug( "Searching for parent-POM: " + parentModel.getId() + " of project: " +
  if ( getLogger().isDebugEnabled() )
    getLogger().debug( "Path specified in <relativePath/> (" + parentRelativePath +
      ") is a directory. Searching for 'pom.xml' within this directory." );
    if ( getLogger().isDebugEnabled() )
      getLogger().debug( "Parent-POM: " + parentModel.getId() + " for project: " +
    getLogger().debug( "Failed to canonicalize potential parent POM: \'" + parentDescriptor + "\'",
              e );
    getLogger().debug( "Using parent-POM from the project hierarchy at: \'" +
    getLogger().debug( "Invalid parent-POM referenced by relative path '" +
else if ( getLogger().isDebugEnabled() )
  getLogger().debug(
    "Parent-POM: " + parentModel.getId() + " not found in relative path: " + parentRelativePath );
if ( getLogger().isDebugEnabled() )
  getLogger().debug( "Retrieving parent-POM: " + parentModel.getId() + " for project: " +

代码示例来源:origin: org.apache.maven/maven-project

private Model createStubModel( Artifact projectArtifact )
{
  getLogger().debug( "Using defaults for missing POM " + projectArtifact );
  Model model = new Model();
  model.setModelVersion( "4.0.0" );
  model.setArtifactId( projectArtifact.getArtifactId() );
  model.setGroupId( projectArtifact.getGroupId() );
  model.setVersion( projectArtifact.getVersion() );
  // TODO: not correct in some instances
  model.setPackaging( projectArtifact.getType() );
  model.setDistributionManagement( new DistributionManagement() );
  model.getDistributionManagement().setStatus( ArtifactStatus.GENERATED.toString() );
  return model;
}

代码示例来源:origin: apache/maven

buffer.append( StringUtils.defaultString( premanagedScope, "default" ) );
    buffer.append( ')' );
    buffer.append( StringUtils.defaultString( premanagedVersion, "default" ) );
    buffer.append( ')' );
    buffer.append( StringUtils.defaultString( premanagedOptional, "default" ) );
    buffer.append( ')' );
  buffer.append( project.getGroupId() );
  buffer.append( ':' ).append( project.getArtifactId() );
  buffer.append( ':' ).append( project.getPackaging() );
  buffer.append( ':' ).append( project.getVersion() );
logger.debug( buffer.toString() );
indent += "   ";
return true;

代码示例来源:origin: apache/maven

if ( artifact.isResolved() )
  artifact.setRepository( repository );
  break;
logger.debug( "Unable to find artifact " + artifact.getId() + " in repository " + repository.getId()
         + " (" + repository.getUrl() + ")", e );
  "Unable to get artifact " + artifact.getId() + " from repository " + repository.getId() + " ("
    + repository.getUrl() + "): " + e.getMessage();
if ( logger.isDebugEnabled() )
  logger.warn( msg, e );
  logger.warn( msg );

代码示例来源:origin: apache/maven

ArtifactTypeRegistry stereotypes = session.getArtifactTypeRegistry();
if ( logger.isDebugEnabled()
  && session.getConfigProperties().get( DependencyManagerUtils.CONFIG_PROP_VERBOSE ) == null )
collect.setRootArtifact( RepositoryUtils.toArtifact( project.getArtifact() ) );
collect.setRequestContext( "project" );
collect.setRepositories( project.getRemoteProjectRepositories() );
if ( project.getDependencyArtifacts() == null )
  for ( Dependency dependency : project.getDependencies() )
    if ( StringUtils.isEmpty( dependency.getGroupId() ) || StringUtils.isEmpty( dependency.getArtifactId() )
      || StringUtils.isEmpty( dependency.getVersion() ) )
  for ( Artifact artifact : project.getDependencyArtifacts() )
    String key = artifact.getDependencyConflictId();
    Dependency dependency = dependencies.get( key );
    Collection<Exclusion> exclusions = dependency != null ? dependency.getExclusions() : null;
if ( logger.isWarnEnabled() )
      logger.warn( "The artifact " + child.getRelocations().get( 0 ) + " has been relocated to "
        + child.getDependency().getArtifact() );
if ( logger.isDebugEnabled() )

代码示例来源:origin: apache/maven

private void validateProjects( List<MavenProject> projects )
{
  Map<String, MavenProject> projectsMap = new HashMap<>();
  for ( MavenProject p : projects )
  {
    String projectKey = ArtifactUtils.key( p.getGroupId(), p.getArtifactId(), p.getVersion() );
    projectsMap.put( projectKey, p );
  }
  for ( MavenProject project : projects )
  {
    // MNG-1911 / MNG-5572: Building plugins with extensions cannot be part of reactor
    for ( Plugin plugin : project.getBuildPlugins() )
    {
      if ( plugin.isExtensions() )
      {
        String pluginKey = ArtifactUtils.key( plugin.getGroupId(), plugin.getArtifactId(),
                           plugin.getVersion() );
        if ( projectsMap.containsKey( pluginKey ) )
        {
          logger.warn( project.getName() + " uses " + plugin.getKey()
            + " as extensions, which is not possible within the same reactor build. "
            + "This plugin was pulled from the local repository!" );
        }
      }
    }
  }
}

相关文章