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

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

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

Logger介绍

暂无

代码示例

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

  1. private String getMavenVersion()
  2. {
  3. Properties props = new Properties();
  4. try ( InputStream is = getClass().getResourceAsStream(
  5. "/META-INF/maven/org.apache.maven/maven-core/pom.properties" ) )
  6. {
  7. if ( is != null )
  8. {
  9. props.load( is );
  10. }
  11. }
  12. catch ( IOException e )
  13. {
  14. logger.debug( "Failed to read Maven version", e );
  15. }
  16. return props.getProperty( "version", "unknown-version" );
  17. }

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

  1. public void info( Throwable error )
  2. {
  3. logger.info( "", error );
  4. }

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

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

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

  1. private void logError( String action, Throwable e, EventSpy spy )
  2. {
  3. String msg = "Failed to " + action + " spy " + spy.getClass().getName() + ": " + e.getMessage();
  4. if ( logger.isDebugEnabled() )
  5. {
  6. logger.warn( msg, e );
  7. }
  8. else
  9. {
  10. logger.warn( msg );
  11. }
  12. }

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

  1. public void notifyFieldChangeUsingSetter( String fieldName, Object value, Object target )
  2. {
  3. if ( logger.isDebugEnabled() )
  4. {
  5. logger.debug( " (s) " + fieldName + " = " + toString( value ) );
  6. }
  7. }

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

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

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

  1. getLogger().debug( "Failed to create directory: " + touchfile.getParent()
  2. + " for tracking artifact metadata resolution." );
  3. return;
  4. try
  5. Properties props = new Properties();
  6. getLogger().debug( "Reading resolution-state from: " + touchfile );
  7. props.load( Channels.newInputStream( channel ) );
  8. props.setProperty( key, Long.toString( System.currentTimeMillis() ) );
  9. getLogger().debug( "Writing resolution-state to: " + touchfile );
  10. channel.truncate( 0 );
  11. props.store( Channels.newOutputStream( channel ), "Last modified on: " + new Date() );
  12. getLogger().debug(
  13. "Failed to record lastUpdated information for resolution.\nFile: " + touchfile.toString()
  14. + "; key: " + key, e );
  15. getLogger().debug( "Error releasing exclusive lock for resolution tracking file: " + touchfile,
  16. e );
  17. getLogger().debug( "Error closing FileChannel for resolution tracking file: " + touchfile, e );

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

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

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

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

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

  1. public void updateLocalCatalog(org.apache.maven.archetype.catalog.Archetype archetype, String path) {
  2. log.debug("Updating local catalog; archetype: " + archetype + ", path: " + path);
  3. try {
  4. Properties properties = new Properties();
  5. properties.setProperty("file", path);
  6. ArchetypeDataSource source = archetypeSources.get("catalog");
  7. assert source != null;
  8. source.updateCatalog(properties, archetype);
  9. }
  10. catch (ArchetypeDataSourceException e) {}
  11. }
  12. }

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

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

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

  1. Date readLastUpdated( File touchfile, String key )
  2. {
  3. getLogger().debug( "Searching for " + key + " in resolution tracking file." );
  4. Properties props = read( touchfile );
  5. if ( props != null )
  6. {
  7. String rawVal = props.getProperty( key );
  8. if ( rawVal != null )
  9. {
  10. try
  11. {
  12. return new Date( Long.parseLong( rawVal ) );
  13. }
  14. catch ( NumberFormatException e )
  15. {
  16. getLogger().debug( "Cannot parse lastUpdated date: \'" + rawVal + "\'. Ignoring.", e );
  17. }
  18. }
  19. }
  20. return null;
  21. }

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

  1. private void restoreCommandLineProperties(ArchetypeConfiguration archetypeConfiguration, Properties executionProperties) {
  2. log.debug("Restoring command line properties");
  3. Iterator properties = archetypeConfiguration.getRequiredProperties().iterator();
  4. while (properties.hasNext()) {
  5. String property = (String) properties.next();
  6. if (executionProperties.containsKey(property)) {
  7. archetypeConfiguration.setProperty(property, executionProperties.getProperty(property));
  8. log.debug("Restored " + property + "=" + archetypeConfiguration.getProperty(property));
  9. }
  10. }
  11. }

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

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

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

  1. if ( getLogger().isDebugEnabled() )
  2. getLogger().debug( "Searching for parent-POM: " + parentModel.getId() + " of project: " +
  3. if ( getLogger().isDebugEnabled() )
  4. getLogger().debug( "Path specified in <relativePath/> (" + parentRelativePath +
  5. ") is a directory. Searching for 'pom.xml' within this directory." );
  6. if ( getLogger().isDebugEnabled() )
  7. getLogger().debug( "Parent-POM: " + parentModel.getId() + " for project: " +
  8. getLogger().debug( "Failed to canonicalize potential parent POM: \'" + parentDescriptor + "\'",
  9. e );
  10. getLogger().debug( "Using parent-POM from the project hierarchy at: \'" +
  11. getLogger().debug( "Invalid parent-POM referenced by relative path '" +
  12. else if ( getLogger().isDebugEnabled() )
  13. getLogger().debug(
  14. "Parent-POM: " + parentModel.getId() + " not found in relative path: " + parentRelativePath );
  15. if ( getLogger().isDebugEnabled() )
  16. getLogger().debug( "Retrieving parent-POM: " + parentModel.getId() + " for project: " +

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

  1. private Model createStubModel( Artifact projectArtifact )
  2. {
  3. getLogger().debug( "Using defaults for missing POM " + projectArtifact );
  4. Model model = new Model();
  5. model.setModelVersion( "4.0.0" );
  6. model.setArtifactId( projectArtifact.getArtifactId() );
  7. model.setGroupId( projectArtifact.getGroupId() );
  8. model.setVersion( projectArtifact.getVersion() );
  9. // TODO: not correct in some instances
  10. model.setPackaging( projectArtifact.getType() );
  11. model.setDistributionManagement( new DistributionManagement() );
  12. model.getDistributionManagement().setStatus( ArtifactStatus.GENERATED.toString() );
  13. return model;
  14. }

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

  1. buffer.append( StringUtils.defaultString( premanagedScope, "default" ) );
  2. buffer.append( ')' );
  3. buffer.append( StringUtils.defaultString( premanagedVersion, "default" ) );
  4. buffer.append( ')' );
  5. buffer.append( StringUtils.defaultString( premanagedOptional, "default" ) );
  6. buffer.append( ')' );
  7. buffer.append( project.getGroupId() );
  8. buffer.append( ':' ).append( project.getArtifactId() );
  9. buffer.append( ':' ).append( project.getPackaging() );
  10. buffer.append( ':' ).append( project.getVersion() );
  11. logger.debug( buffer.toString() );
  12. indent += " ";
  13. return true;

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

  1. if ( artifact.isResolved() )
  2. artifact.setRepository( repository );
  3. break;
  4. logger.debug( "Unable to find artifact " + artifact.getId() + " in repository " + repository.getId()
  5. + " (" + repository.getUrl() + ")", e );
  6. "Unable to get artifact " + artifact.getId() + " from repository " + repository.getId() + " ("
  7. + repository.getUrl() + "): " + e.getMessage();
  8. if ( logger.isDebugEnabled() )
  9. logger.warn( msg, e );
  10. logger.warn( msg );

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

  1. ArtifactTypeRegistry stereotypes = session.getArtifactTypeRegistry();
  2. if ( logger.isDebugEnabled()
  3. && session.getConfigProperties().get( DependencyManagerUtils.CONFIG_PROP_VERBOSE ) == null )
  4. collect.setRootArtifact( RepositoryUtils.toArtifact( project.getArtifact() ) );
  5. collect.setRequestContext( "project" );
  6. collect.setRepositories( project.getRemoteProjectRepositories() );
  7. if ( project.getDependencyArtifacts() == null )
  8. for ( Dependency dependency : project.getDependencies() )
  9. if ( StringUtils.isEmpty( dependency.getGroupId() ) || StringUtils.isEmpty( dependency.getArtifactId() )
  10. || StringUtils.isEmpty( dependency.getVersion() ) )
  11. for ( Artifact artifact : project.getDependencyArtifacts() )
  12. String key = artifact.getDependencyConflictId();
  13. Dependency dependency = dependencies.get( key );
  14. Collection<Exclusion> exclusions = dependency != null ? dependency.getExclusions() : null;
  15. if ( logger.isWarnEnabled() )
  16. logger.warn( "The artifact " + child.getRelocations().get( 0 ) + " has been relocated to "
  17. + child.getDependency().getArtifact() );
  18. if ( logger.isDebugEnabled() )

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

  1. private void validateProjects( List<MavenProject> projects )
  2. {
  3. Map<String, MavenProject> projectsMap = new HashMap<>();
  4. for ( MavenProject p : projects )
  5. {
  6. String projectKey = ArtifactUtils.key( p.getGroupId(), p.getArtifactId(), p.getVersion() );
  7. projectsMap.put( projectKey, p );
  8. }
  9. for ( MavenProject project : projects )
  10. {
  11. // MNG-1911 / MNG-5572: Building plugins with extensions cannot be part of reactor
  12. for ( Plugin plugin : project.getBuildPlugins() )
  13. {
  14. if ( plugin.isExtensions() )
  15. {
  16. String pluginKey = ArtifactUtils.key( plugin.getGroupId(), plugin.getArtifactId(),
  17. plugin.getVersion() );
  18. if ( projectsMap.containsKey( pluginKey ) )
  19. {
  20. logger.warn( project.getName() + " uses " + plugin.getKey()
  21. + " as extensions, which is not possible within the same reactor build. "
  22. + "This plugin was pulled from the local repository!" );
  23. }
  24. }
  25. }
  26. }
  27. }

相关文章