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


Java Log.isDebugEnabled方法代碼示例

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


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

示例1: 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

示例2: downloadHttpResource

import org.apache.maven.plugin.logging.Log; //導入方法依賴的package包/類
private boolean downloadHttpResource(Log log, String remote, File local) throws MojoExecutionException {
  local.getParentFile().mkdirs();
  InputStream stream = null;
  CloseableHttpClient httpclient = HttpClients.custom().disableContentCompression().build();
  try {
    HttpEntity entity = httpclient.execute(new HttpGet(remote)).getEntity();
    if (entity != null) {
      stream = entity.getContent();
      Files.copy(stream, local.toPath());
      return true;
    }
  } catch (Exception exception) {
    if (log.isDebugEnabled()) {
      log.debug("Error downloading resource [" + remote + "]", exception);
    }
  } finally {
    IOUtils.closeQuietly(stream);
    IOUtils.closeQuietly(httpclient);
  }
  return false;
}
 
開發者ID:ggear,項目名稱:cloudera-parcel,代碼行數:22,代碼來源:Parcel.java

示例3: assertSha1

import org.apache.maven.plugin.logging.Log; //導入方法依賴的package包/類
private boolean assertSha1(Log log, File file, File fileSha1, boolean quiet) throws MojoExecutionException {
  InputStream input = null;
  try {
    if (!IOUtils.toString(input = new FileInputStream(fileSha1)).trim().toUpperCase().equals(calculateSha1(file).toUpperCase())) {
      if (quiet) {
        return false;
      } else {
        throw new MojoExecutionException("File [" + file + "] is not consistent with hash file [" + fileSha1 + "]");
      }
    }
    return true;
  } catch (Exception exception) {
    if (quiet) {
      if (log.isDebugEnabled()) {
        log.debug("Could not verify file [" + file + "] is consistent with hash file [" + fileSha1 + "]", exception);
      }
      return false;
    } else {
      throw new MojoExecutionException("Could not verify file [" + file + "] is consistent with hash file [" + fileSha1 + "]");
    }
  } finally {
    IOUtils.closeQuietly(input);
  }
}
 
開發者ID:ggear,項目名稱:cloudera-parcel,代碼行數:25,代碼來源:Parcel.java

示例4: execute

import org.apache.maven.plugin.logging.Log; //導入方法依賴的package包/類
public int execute(@Nullable String customCommand, @Nonnull final Log logger, @Nonnull final File cvsFolder, @Nonnull @MustNotContainNull final String... args) {
    final List<String> cli = new ArrayList<>();
    cli.add(GetUtils.findFirstNonNull(customCommand, this.command));
    for (final String s : args) {
        cli.add(s);
    }

    if (logger.isDebugEnabled()) {
        logger.debug("Executing repo command : " + cli);
    }

    final ByteArrayOutputStream errorStream = new ByteArrayOutputStream();
    final ByteArrayOutputStream outStream = new ByteArrayOutputStream();

    final ProcessExecutor executor = new ProcessExecutor(cli);

    int result = -1;

    try {
        final ProcessResult processResult = executor.directory(cvsFolder).redirectError(errorStream).redirectOutput(outStream).executeNoTimeout();
        result = processResult.getExitValue();

        if (logger.isDebugEnabled()) {
            logger.debug("Exec.out.........................................");
            logger.debug(new String(errorStream.toByteArray(), Charset.defaultCharset()));
            logger.debug(".................................................");
        }

        if (result != 0) {
            logger.error(new String(errorStream.toByteArray(), Charset.defaultCharset()));
        }

    } catch (Exception ex) {
        logger.error("Unexpected error", ex);
    }

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

示例5: ScannerFactory

import org.apache.maven.plugin.logging.Log; //導入方法依賴的package包/類
public ScannerFactory(LogOutput logOutput, Log log, RuntimeInformation runtimeInformation, MojoExecution mojoExecution, MavenSession session,
  Properties envProps, PropertyDecryptor propertyDecryptor) {
  this.logOutput = logOutput;
  this.log = log;
  this.runtimeInformation = runtimeInformation;
  this.mojoExecution = mojoExecution;
  this.session = session;
  this.debugEnabled = log.isDebugEnabled();
  this.envProps = envProps;
  this.propertyDecryptor = propertyDecryptor;
}
 
開發者ID:SonarSource,項目名稱:sonar-scanner-maven,代碼行數:12,代碼來源:ScannerFactory.java

示例6: download

import org.apache.maven.plugin.logging.Log; //導入方法依賴的package包/類
public boolean download(Log log) throws MojoExecutionException {
  isValid(ImmutableMap.of("localRepositoryDirectory", localRepositoryDirectory, "repositoryUrl", repositoryUrl));
  boolean downloaded = false;
  File localPath = new File(getFile(localRepositoryDirectory).getAbsolutePath(), getLocalPath());
  File localPathSha1 = new File(getFile(localRepositoryDirectory).getAbsolutePath(), getLocalPath() + SUFFIX_SHA1);
  if (localPath.exists() && localPathSha1.exists()) {
    if (!assertSha1(log, localPath, localPathSha1, true)) {
      localPath.delete();
      localPathSha1.delete();
    }
  } else if (localPath.exists() && !localPathSha1.exists()) {
    localPath.delete();
  } else if (!localPath.exists() && localPathSha1.exists()) {
    localPathSha1.delete();
  }
  if (!localPath.exists() && !localPathSha1.exists()) {
    if (log.isInfoEnabled()) {
      log.info("Downloading: " + getRemoteUrl(repositoryUrl));
    }
    try {
      String remoteUrl = getRemoteUrl(repositoryUrl);
      String remoteUrlSha1 = getRemoteUrl(repositoryUrl) + SUFFIX_SHA1;
      long time = System.currentTimeMillis();
      if (downloaded = downloadHttpResource(log, remoteUrl, localPath) && downloadHttpResource(log, remoteUrlSha1, localPathSha1)) {
        if (!(downloaded = assertSha1(log, localPath, localPathSha1, true))) {
          localPath.delete();
          localPathSha1.delete();
          throw new MojoExecutionException("Downloaded file from [" + remoteUrl + "] failed to match checksum [" + remoteUrlSha1 + "]");
        }
        if (log.isInfoEnabled()) {
          log.info(
            "Downloaded: " + remoteUrl + " (" + FileUtils.byteCountToDisplaySize(localPath.length() + localPathSha1.length()) + " at "
              + String.format("%.2f", (localPath.length() + localPathSha1.length()) / ((System.currentTimeMillis() - time) * 1000D))
              + " MB/sec)");
        }
      }
    } catch (Exception exception) {
      if (log.isDebugEnabled()) {
        log.debug("Error encountered downlaoding parcel [" + getArtifactName() + "]", exception);
      }
    }
    if (!downloaded) {
      throw new MojoExecutionException("Could not find parcel [" + getArtifactName() + "] in remote repositories, "
        + "see above for download attemps and try a mvn -X invocation for DEBUG logs showing transport exceptions");
    }
  }
  return downloaded;
}
 
開發者ID:ggear,項目名稱:cloudera-parcel,代碼行數:49,代碼來源:Parcel.java


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