當前位置: 首頁>>代碼示例>>Java>>正文


Java Log類代碼示例

本文整理匯總了Java中org.apache.maven.plugin.logging.Log的典型用法代碼示例。如果您正苦於以下問題:Java Log類的具體用法?Java Log怎麽用?Java Log使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Log類屬於org.apache.maven.plugin.logging包,在下文中一共展示了Log類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: copyFile

import org.apache.maven.plugin.logging.Log; //導入依賴的package包/類
/**
 * Does the actual copy of the file and logging.
 *
 * @param artifact represents the file to copy.
 * @param destFile file name of destination file.
 *
 * @throws MojoExecutionException with a message if an
 *             error occurs.
 */
protected void copyFile ( File artifact, File destFile )
    throws MojoExecutionException
{
    Log theLog = this.getLog();
    try
    {
        theLog.info( "Copying "
            + ( this.outputAbsoluteArtifactFilename ? artifact.getAbsolutePath() : artifact.getName() ) + " to "
            + destFile );
        FileUtils.copyFile( artifact, destFile );

    }
    catch ( Exception e )
    {
        throw new MojoExecutionException( "Error copying artifact from " + artifact + " to " + destFile, e );
    }
}
 
開發者ID:kefik,項目名稱:Pogamut3,代碼行數:27,代碼來源:AbstractDependencyMojo.java

示例2: testLog

import org.apache.maven.plugin.logging.Log; //導入依賴的package包/類
public void testLog()
{
    Log log = new DependencySilentLog();
    String text = new String( "Text" );
    Throwable e = new RuntimeException();
    log.debug( text );
    log.debug( text, e );
    log.debug( e );
    log.info( text );
    log.info( text, e );
    log.info( e );
    log.warn( text );
    log.warn( text, e );
    log.warn( e );
    log.error( text );
    log.error( text, e );
    log.error( e );
    log.isDebugEnabled();
    log.isErrorEnabled();
    log.isWarnEnabled();
    log.isInfoEnabled();
}
 
開發者ID:kefik,項目名稱:Pogamut3,代碼行數:23,代碼來源:TestSilentLog.java

示例3: removeDirectory

import org.apache.maven.plugin.logging.Log; //導入依賴的package包/類
/**
 * Deletes a directory and its contents.
 * 
 * @param dir
 *            The base directory of the included and excluded files.
 * @throws IOException
 * @throws MojoExecutionException
 *             When a directory failed to get deleted.
 */
public static void removeDirectory( File dir )
    throws IOException
{
    if ( dir != null )
    {
        Log log = new SilentLog();
        FileSetManager fileSetManager = new FileSetManager( log, false );

        FileSet fs = new FileSet();
        fs.setDirectory( dir.getPath() );
        fs.addInclude( "**/**" );
        fileSetManager.delete( fs );

    }
}
 
開發者ID:kefik,項目名稱:Pogamut3,代碼行數:25,代碼來源:DependencyTestUtils.java

示例4: sendGetCommand

import org.apache.maven.plugin.logging.Log; //導入依賴的package包/類
/**
 * sendGetCommand
 * 
 * @param url
 * @param log
 * @return
 * @throws MojoExecutionException
 * @throws CheckException
 */
public Map<String, String> sendGetCommand( String url, Log log )
    throws CheckException
{
    Map<String, String> response = new HashMap<String, String>();
    CloseableHttpClient httpclient = HttpClients.createDefault();
    HttpGet httpget = new HttpGet( url );
    try
    {
        CloseableHttpResponse httpResponse = httpclient.execute( httpget, localContext );
        ResponseHandler<String> handler = new ResponseErrorHandler();
        String body = handler.handleResponse( httpResponse );
        response.put( "body", body );
        httpResponse.close();

    }
    catch ( Exception e )
    {
        log.warn( "GET request failed!" );

        throw new CheckException( "Send GET to server failed!", e );
    }

    return response;
}
 
開發者ID:oncecloud,項目名稱:devops-cstack,代碼行數:34,代碼來源:RestUtils.java

示例5: execute

import org.apache.maven.plugin.logging.Log; //導入依賴的package包/類
@Override
public void execute() throws MojoExecutionException {
  final Log log = getLog();

  if (skipZip) {
    log.info("skipZip is true. Skipping zipping.");
    return;
  }
  try {
    for (ZipTarget zipTarget : zipTargets) {

      ZipUtil.writeZip(zipTarget.getZipFiles(), zipTarget.getZipDest(), buildPath);
      log.info("Created zip:" + zipTarget.getZipDest());
    }
  } catch (IOException e) {
    throw new MojoExecutionException("IO Exception encountered: ", e);
  }
}
 
開發者ID:tsiq,項目名稱:magic-beanstalk,代碼行數:19,代碼來源:ZipMojo.java

示例6: execute

import org.apache.maven.plugin.logging.Log; //導入依賴的package包/類
public static void execute(ContainerOrchestrationRuntime runtime, Carnotzet carnotzet, Log log)
		throws MojoExecutionException, MojoFailureException {
	try {
		IpPlaceholderResolver ipPlaceholderResolver = new IpPlaceholderResolver(runtime);

		WelcomePageGenerator generator = new WelcomePageGenerator(Arrays.asList(ipPlaceholderResolver));

		Path moduleResources = carnotzet.getResourcesFolder().resolve("expanded-jars");
		Path welcomePagePath = carnotzet.getResourcesFolder().resolve("welcome.html");

		generator.buildWelcomeHtmlFile(moduleResources, welcomePagePath);

		new ProcessBuilder("xdg-open", "file://" + welcomePagePath).start();
		log.info("********************************************************");
		log.info("*                                                      *");
		log.info("* The WELCOME page was opened in your default browser  *");
		log.info("*                                                      *");
		log.info("********************************************************");
	}
	catch (IOException e) {
		throw new MojoExecutionException("Cannot start browser:" + e, e);
	}
}
 
開發者ID:swissquote,項目名稱:carnotzet,代碼行數:24,代碼來源:Welcome.java

示例7: execute

import org.apache.maven.plugin.logging.Log; //導入依賴的package包/類
public static void execute(ContainerOrchestrationRuntime runtime, Log log) {
	List<Container> containers = runtime.getContainers();
	if (containers.isEmpty()) {
		log.info("There doesn't seem to be any containers created yet for this carnotzet, please make sure the carnotzet is started");
		return;
	}

	log.info("");
	log.info(String.format("%-25s", "APPLICATION") + "   IP ADDRESS");
	log.info("");
	for (Container container : containers) {
		log.info(String.format("%-25s", container.getServiceName()) + " : "
				+ (container.getIp() == null ? "No address, is container started ?"
				: container.getIp() + " (" + container.getServiceName() + ".docker)"));
	}
	log.info("");
}
 
開發者ID:swissquote,項目名稱:carnotzet,代碼行數:18,代碼來源:Addresses.java

示例8: promptForContainer

import org.apache.maven.plugin.logging.Log; //導入依賴的package包/類
/**
 * Lists services and prompts the user to choose one
 */
private static Container promptForContainer(List<Container> containers, Prompter prompter, Log log) throws MojoExecutionException {

	log.info("");
	log.info("SERVICE");
	log.info("");
	Map<Integer, Container> options = new HashMap<>();
	Integer i = 1;

	for (Container container : containers) {
		options.put(i, container);
		log.info(String.format("%2d", i) + " : " + container.getServiceName());
		i++;
	}
	log.info("");
	try {
		String prompt = prompter.prompt("Choose a service");
		return options.get(Integer.valueOf(prompt));
	}
	catch (PrompterException e) {
		throw new MojoExecutionException("Prompter error" + e.getMessage());
	}
}
 
開發者ID:swissquote,項目名稱:carnotzet,代碼行數:26,代碼來源:Shell.java

示例9: MinijarFilter

import org.apache.maven.plugin.logging.Log; //導入依賴的package包/類
/**
 * @param project {@link MavenProject}
 * @param log {@link Log}
 * @param simpleFilters {@link SimpleFilter}
 * @throws IOException in case of errors.
 * @since 1.6
 */
public MinijarFilter( MavenProject project, Log log, List<SimpleFilter> simpleFilters )
    throws IOException
{

    this.log = log;

    Clazzpath cp = new Clazzpath();

    ClazzpathUnit artifactUnit =
        cp.addClazzpathUnit( new FileInputStream( project.getArtifact().getFile() ), project.toString() );

    for ( Artifact dependency : project.getArtifacts() )
    {
        addDependencyToClasspath( cp, dependency );
    }

    removable = cp.getClazzes();
    removePackages( artifactUnit );
    removable.removeAll( artifactUnit.getClazzes() );
    removable.removeAll( artifactUnit.getTransitiveDependencies() );
    removeSpecificallyIncludedClasses( project, simpleFilters == null ? Collections.<SimpleFilter>emptyList()
                    : simpleFilters );
}
 
開發者ID:javiersigler,項目名稱:apache-maven-shade-plugin,代碼行數:31,代碼來源:MinijarFilter.java

示例10: uploadConfig

import org.apache.maven.plugin.logging.Log; //導入依賴的package包/類
/**
 * Upload config to ZK
 * 
 * @param log maven log
 * @throws MojoExecutionException exception
 */
public synchronized void uploadConfig(Log log) throws MojoExecutionException {
	try (SolrZkClient zkClient = new SolrZkClient(solrCloud.getZkServer().getZkAddress(chroot), TIMEOUT, TIMEOUT, null)) {
		ZkConfigManager manager = new ZkConfigManager(zkClient);
		if(manager.configExists(configName)) {
			throw new MojoExecutionException("Config " + configName + " already exists on ZK");
		}
		
		log.debug("about to upload config from " + confDir + " to " + configName);
		manager.uploadConfigDir(confDir, configName);
		log.debug("Config uploaded");
	}
	catch (IOException e) {
		throw new MojoExecutionException("Can't upload solr config in ZK " + configName, e);
	}
}
 
開發者ID:BorisNaguet,項目名稱:solr-maven-plugin,代碼行數:22,代碼來源:SolrCloudManager.java

示例11: buildDockerInfoJar

import org.apache.maven.plugin.logging.Log; //導入依賴的package包/類
@Nonnull
protected File buildDockerInfoJar(@Nonnull Log log) throws MojoExecutionException {
  final File jarFile = getJarFile(buildDirectory, finalName, classifier);

  final MavenArchiver archiver = new MavenArchiver();
  archiver.setArchiver(jarArchiver);
  archiver.setOutputFile(jarFile);

  archive.setForced(forceCreation);

  if (dockerInfoDirectory.exists()) {
    final String prefix = getMetaSubdir();
    archiver.getArchiver().addDirectory(dockerInfoDirectory, prefix);
  } else {
    log.warn("Docker info directory not created - Docker info JAR will be empty");
  }

  try {
    archiver.createArchive(session, project, archive);
  } catch (Exception e) {
    throw new MojoExecutionException("Could not build Docker info JAR", e);
  }

  return jarFile;
}
 
開發者ID:spotify,項目名稱:dockerfile-maven,代碼行數:26,代碼來源:AbstractDockerMojo.java

示例12: createZipFile

import org.apache.maven.plugin.logging.Log; //導入依賴的package包/類
/**
 * Creates a zip fie from the given source directory and output zip file name
 */
public static void createZipFile(Log log, File sourceDir, File outputZipFile) throws IOException {
    outputZipFile.getParentFile().mkdirs();
    OutputStream os = new FileOutputStream(outputZipFile);
    ZipOutputStream zos = new ZipOutputStream(os);
    try {
        //zos.setLevel(Deflater.DEFAULT_COMPRESSION);
        //zos.setLevel(Deflater.NO_COMPRESSION);
        String path = "";
        FileFilter filter = null;
        zipDirectory(log, sourceDir, zos, path, filter);
    } finally {
        try {
            zos.close();
        } catch (Exception e) {
        }
    }
}
 
開發者ID:nkasvosve,項目名稱:beyondj,代碼行數:21,代碼來源:Zips.java

示例13: MavenEnvironment

import org.apache.maven.plugin.logging.Log; //導入依賴的package包/類
public MavenEnvironment(MavenSession aMavenSession, BuildPluginManager aBuildPluginManager, Log aLog,
        DependencyTreeBuilder aDependencyTreeBuilder, ArtifactRepository aLocalRepository,
        SecDispatcher aSecurityDispatcher, MavenProjectBuilder aProjectBuilder,
        LifecycleExecutor aLifecycleExecutor, ArtifactFactory aArtifactFactory,
        ArtifactMetadataSource aArtifactMetadataSource, ArtifactCollector aArtifactCollector, RuntimeInformation aRuntimeInformation,
        MojoExecution aExecution) {
    mavenSession = aMavenSession;
    buildPluginManager = aBuildPluginManager;
    log = aLog;
    dependencyTreeBuilder = aDependencyTreeBuilder;
    localRepository = aLocalRepository;
    securityDispatcher = aSecurityDispatcher;
    projectBuilder = aProjectBuilder;
    lifecycleExecutor = aLifecycleExecutor;
    artifactFactory = aArtifactFactory;
    artifactMetadataSource = aArtifactMetadataSource;
    artifactCollector = aArtifactCollector;
    runtimeInformation = aRuntimeInformation;
    mojoExecution = aExecution;
}
 
開發者ID:mirkosertic,項目名稱:mavensonarsputnik,代碼行數:21,代碼來源:MavenEnvironment.java

示例14: scanDirectory

import org.apache.maven.plugin.logging.Log; //導入依賴的package包/類
private void scanDirectory(File directory, BufferedWriter writer) throws IOException {
    if (!directory.exists())
        return;

    final Log log = getLog();
    log.info("scanning source directory '" + directory.getAbsolutePath() + "'");

    DirectoryScanner scanner = new DirectoryScanner();
    scanner.setIncludes(includes);
    scanner.setExcludes(excludes);
    scanner.setBasedir(directory);
    scanner.scan();

    for (String fileName : scanner.getIncludedFiles()) {
        writer.write(fileName);
        writer.newLine();
    }
}
 
開發者ID:HostingAgency,項目名稱:gwtcoverage-maven-plugin,代碼行數:19,代碼來源:SourcesListMojo.java

示例15: processCVSRequisites

import org.apache.maven.plugin.logging.Log; //導入依賴的package包/類
@Override
public boolean processCVSRequisites(
        @Nonnull final Log logger,
        @Nullable final ProxySettings proxy,
        @Nullable final String customCommand,
        @Nonnull final File cvsFolder,
        @Nullable final String branchId,
        @Nullable final String tagId,
        @Nullable final String revisionId
) {
    boolean noError = true;

    if (branchId != null) {
        noError &= upToBranch(logger, proxy, customCommand, cvsFolder, branchId);
    }

    if (noError && tagId != null) {
        noError &= upToTag(logger, proxy, customCommand, cvsFolder, tagId);
    }

    if (noError && revisionId != null) {
        noError &= upToRevision(logger, proxy, customCommand, cvsFolder, revisionId);
    }

    return noError;
}
 
開發者ID:raydac,項目名稱:mvn-golang,代碼行數:27,代碼來源:CvsSVN.java


注:本文中的org.apache.maven.plugin.logging.Log類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。