org.gradle.api.logging.Logger.isDebugEnabled()方法的使用及代码示例

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

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

Logger.isDebugEnabled介绍

暂无

代码示例

代码示例来源:origin: gradle.plugin.com.s390x/gogradle

private void beforeMethod(MethodInvocation methodInvocation) {
  if (!LOGGER.isDebugEnabled()) {
    return;
  }
  Object target = methodInvocation.getThis();
  Object[] arguments = methodInvocation.getArguments();
  Method method = methodInvocation.getMethod();
  LOGGER.debug("Entering method {} of class {}, the arguments is {}",
      method.getName(), target.getClass().getSimpleName(),
      toString(arguments));
}

代码示例来源:origin: org.gradle/gradle-core

@Override
public void discardTypesFrom(ClassLoader classLoader) {
  if (classLoader == leakingLoader) {
    throw new IllegalStateException("Cannot remove own types from Groovy loader.");
  }
  // Remove cached value for every class seen by this ClassLoader that was loaded by the given ClassLoader
  try {
    Iterator<?> it = globalClassSetIterator();
    while (it.hasNext()) {
      Object classInfo = it.next();
      if (classInfo != null) {
        Class clazz = (Class) clazzField.get(classInfo);
        if (clazz.getClassLoader() == classLoader) {
          removeFromGlobalClassValue.invoke(globalClassValue, clazz);
          if (LOG.isDebugEnabled()) {
            LOG.debug("Removed ClassInfo from {} loaded by {}", clazz.getName(), clazz.getClassLoader());
          }
        }
      }
    }
  } catch (Exception e) {
    throw new GradleException("Could not remove types for ClassLoader " + classLoader + " from the Groovy system " + leakingLoader, e);
  }
}

代码示例来源:origin: org.gradle/gradle-core

@Override
public void shutdown() {
  if (leakingLoader == getClass().getClassLoader()) {
    throw new IllegalStateException("Cannot shut down the main Groovy loader.");
  }
  // Remove cached value for every class seen by this ClassLoader
  try {
    Iterator<?> it = globalClassSetIterator();
    while (it.hasNext()) {
      Object classInfo = it.next();
      if (classInfo != null) {
        Class clazz = (Class) clazzField.get(classInfo);
        removeFromGlobalClassValue.invoke(globalClassValue, clazz);
        if (LOG.isDebugEnabled()) {
          LOG.debug("Removed ClassInfo from {} loaded by {}", clazz.getName(), clazz.getClassLoader());
        }
      }
    }
  } catch (Exception e) {
    throw new GradleException("Could not shut down the Groovy system for " + leakingLoader, e);
  }
}

代码示例来源:origin: org.gradle/gradle-core

protected BuildOperationLogInfo createLogInfo(String taskName, File outputFile, int maximumFailures) {
    final BuildOperationLogInfo configuration;
    if (logger.isDebugEnabled()) {
      // show all operation output when debug is enabled
      configuration = new BuildOperationLogInfo(taskName, outputFile, Integer.MAX_VALUE);
    } else {
      configuration = new BuildOperationLogInfo(taskName, outputFile, maximumFailures);
    }
    return configuration;
  }
}

代码示例来源:origin: org.gradle/gradle-core

public IsolatedAntBuilder withClasspath(Iterable<File> classpath) {
  if (LOG.isDebugEnabled()) {
    LOG.debug("Forking a new isolated ant builder for classpath : {}", classpath);
  }
  return new DefaultIsolatedAntBuilder(this, classpath);
}

代码示例来源:origin: gradle.plugin.com.s390x/gogradle

private void afterMethod(MethodInvocation methodInvocation, Object returnValue, Throwable e, long nanoseconds) {
  if (!LOGGER.isDebugEnabled()) {
    return;
  }
  Object target = methodInvocation.getThis();
  Method method = methodInvocation.getMethod();
  if (e == null) {
    LOGGER.debug("Exiting method {} of class {}, total time is {} ms, return {}",
        method.getName(),
        target.getClass().getSimpleName(),
        toString(nanoseconds),
        returnValue);
  } else {
    LOGGER.debug("Exiting method {} of class {}, total time is {} ms, exception is {}",
        method.getName(),
        target.getClass().getSimpleName(),
        toString(nanoseconds),
        toString(e));
  }
}

代码示例来源:origin: gradle.plugin.org.codeartisans.gradle/gradle-wsdl-plugin

private List<String> wsImportArgumentsFor( Wsdl wsdl ) {
  File wsdlFile = getProject().file( wsdl.getWsdl() );
  List<String> arguments = new ArrayList<>();
  if( wsdl.getPackageName() != null ) {
    arguments.add( "-p" );
    arguments.add( wsdl.getPackageName() );
  }
  arguments.add( "-wsdllocation" );
  arguments.add( wsdlFile.getName() );
  arguments.add( "-s" );
  arguments.add( outputDirectory.getAbsolutePath() );
  arguments.add( "-extension" );
  arguments.add( "-Xnocompile" );
  if (wsdl.getExtraArgs() != null) {
    arguments.addAll(Arrays.asList(wsdl.getExtraArgs().split(" ")));
  }
  if( getProject().getLogger().isDebugEnabled() ) {
    arguments.add( "-Xdebug" );
  } else {
    arguments.add( "-quiet" );
  }
  arguments.add( wsdlFile.getAbsolutePath() );
  return arguments;
}

代码示例来源:origin: org.gradle/gradle-core

public boolean shouldWatch(File directory) {
  final boolean result = rootSubset.isInRootsOrAncestorOrAnyRoot(directory) || isAncestorOfAnyRoot(directory, allRequestedRoots, true);
  if (!result && LOG.isDebugEnabled()) {
    LOG.debug("not watching directory: {} allRequestedRoots: {} roots: {} unfiltered: {}", directory, allRequestedRoots, rootSubset.roots, rootSubset.combinedFileSystemSubset);
  }
  return result;
}

代码示例来源:origin: org.gradle/gradle-core

private void removeCacheEntry(ClassPath key, Cleanup entry, Cleanup.Mode mode) {
  if (LOG.isDebugEnabled()) {
    LOG.debug("Removing classloader from cache, classpath = {}", key.getAsURIs());
  }
  lock.lock();
  try {
    cacheEntries.remove(key);
    cleanups.remove(key);
  } finally {
    lock.unlock();
  }
  try {
    entry.clear();
    entry.cleanup(mode);
  } catch (Exception ex) {
    LOG.error("Unable to perform cleanup of classloader for classpath: "+key, ex);
  }
}

代码示例来源:origin: steffenschaefer/gwt-gradle-plugin

private LogLevel getLogLevel() {
  if(logger.isTraceEnabled()) {
    return LogLevel.TRACE;
  } else if(logger.isDebugEnabled()) {
    return LogLevel.DEBUG;
  } else if(logger.isInfoEnabled()) {
    return LogLevel.INFO;
  } else if(logger.isLifecycleEnabled() || logger.isWarnEnabled()) {
    return LogLevel.WARN;
  }
  // QUIET or ERROR
  return LogLevel.ERROR;
}

代码示例来源:origin: org.gradle/gradle-core

public void run() {
  final AtomicLong busy = new AtomicLong(0);
  Timer totalTimer = Time.startTimer();
  final Timer taskTimer = Time.startTimer();
  WorkerLease childLease = parentWorkerLease.createChild();
  boolean moreTasksToExecute = true;
  while (moreTasksToExecute) {
    moreTasksToExecute = taskExecutionPlan.executeWithTask(childLease, new Action<TaskInfo>() {
      @Override
      public void execute(TaskInfo task) {
        final String taskPath = task.getTask().getPath();
        LOGGER.info("{} ({}) started.", taskPath, Thread.currentThread());
        taskTimer.reset();
        processTask(task);
        long taskDuration = taskTimer.getElapsedMillis();
        busy.addAndGet(taskDuration);
        if (LOGGER.isInfoEnabled()) {
          LOGGER.info("{} ({}) completed. Took {}.", taskPath, Thread.currentThread(), TimeFormatting.formatDurationVerbose(taskDuration));
        }
      }
    });
  }
  long total = totalTimer.getElapsedMillis();
  if (LOGGER.isDebugEnabled()) {
    LOGGER.debug("Task worker [{}] finished, busy: {}, idle: {}", Thread.currentThread(), TimeFormatting.formatDurationVerbose(busy.get()), TimeFormatting.formatDurationVerbose(total - busy.get()));
  }
}

代码示例来源:origin: org.sonarsource.scanner.gradle/sonarqube-gradle-plugin

@TaskAction
public void run() {
 Map<String, String> properties = getProperties();
 if (properties.isEmpty()) {
  LOGGER.warn("Skipping SonarQube analysis: no properties configured, was it skipped in all projects?");
  return;
 }
 if (LOGGER.isDebugEnabled()) {
  properties.put("sonar.verbose", "true");
 }
 if (isSkippedWithProperty(properties)) {
  return;
 }
 EmbeddedScanner scanner = EmbeddedScanner.create("ScannerGradle", getPluginVersion() + "/" + getProject().getGradle().getGradleVersion(), LOG_OUTPUT)
  .addGlobalProperties(properties);
 scanner.start();
 scanner.execute(new HashMap<>());
}

代码示例来源:origin: SonarSource/sonar-scanner-gradle

@TaskAction
public void run() {
 Map<String, String> properties = getProperties();
 if (properties.isEmpty()) {
  LOGGER.warn("Skipping SonarQube analysis: no properties configured, was it skipped in all projects?");
  return;
 }
 if (LOGGER.isDebugEnabled()) {
  properties.put("sonar.verbose", "true");
 }
 if (isSkippedWithProperty(properties)) {
  return;
 }
 EmbeddedScanner scanner = EmbeddedScanner.create("ScannerGradle", getPluginVersion() + "/" + getProject().getGradle().getGradleVersion(), LOG_OUTPUT)
  .addGlobalProperties(properties);
 scanner.start();
 scanner.execute(new HashMap<>());
}

代码示例来源:origin: gradle.plugin.com.liferay/gradle-plugins-node

@Override
public String call() throws Exception {
  String logLevel = null;
  Logger logger = getLogger();
  if (logger.isTraceEnabled()) {
    logLevel = "silly";
  }
  else if (logger.isDebugEnabled()) {
    logLevel = "verbose";
  }
  else if (logger.isInfoEnabled()) {
    logLevel = "info";
  }
  else if (logger.isWarnEnabled()) {
    logLevel = "warn";
  }
  else if (logger.isErrorEnabled()) {
    logLevel = "error";
  }
  return logLevel;
}

代码示例来源:origin: com.liferay/com.liferay.gradle.plugins.node

@Override
public String call() throws Exception {
  String logLevel = null;
  Logger logger = getLogger();
  if (logger.isTraceEnabled()) {
    logLevel = "silly";
  }
  else if (logger.isDebugEnabled()) {
    logLevel = "verbose";
  }
  else if (logger.isInfoEnabled()) {
    logLevel = "info";
  }
  else if (logger.isWarnEnabled()) {
    logLevel = "warn";
  }
  else if (logger.isErrorEnabled()) {
    logLevel = "error";
  }
  return logLevel;
}

代码示例来源:origin: gradle.plugin.de.otto.shopoffice/otto-classycle-plugin

private Task createClassycleTask(final Project project, final ClassycleExtension extension, final SourceSet sourceSet) {
  final String taskName = sourceSet.getTaskName("classycle", null);
  final FileCollection classesDirs = sourceSet.getOutput().getClassesDirs();
  final File reportFile = getReportingExtension(project).file("classycle_" + sourceSet.getName() + ".txt");
  final Task task = project.task(taskName);
  task.getInputs().files(classesDirs, extension.getDefinitionFile());
  task.getOutputs().file(reportFile);
  task.doLast(new ClassyclePlugin.ClassycleAction(classesDirs, reportFile, extension));
  // the classycle task depends on the corresponding classes task
  final String classesTask = sourceSet.getClassesTaskName();
  task.dependsOn(classesTask);
  if (project.getLogger().isDebugEnabled()) {
    final StringBuilder sb = new StringBuilder();
    for (final File file : classesDirs) {
      sb.append(file.getAbsolutePath()).append(" ");
    }
    project.getLogger()
        .debug("Created classycle task: " + taskName + ", report file: " + reportFile + ", depends on: "
            + classesTask + " - sourceSetDirs: " + sb.toString());
  }
  return task;
}

代码示例来源:origin: org.gradle/gradle-core

public void buildStarted(Gradle gradle) {
  StartParameter startParameter = gradle.getStartParameter();
  logger.info("Starting Build");
  if (logger.isDebugEnabled()) {
    logger.debug("Gradle user home: {}", startParameter.getGradleUserHomeDir());
    logger.debug("Current dir: {}", startParameter.getCurrentDir());
    logger.debug("Settings file: {}", startParameter.getSettingsFile());
    logger.debug("Build file: {}", startParameter.getBuildFile());
  }
}

代码示例来源:origin: gradle.plugin.org.gosu-lang.gosu/gradle-gosu-plugin

private DefaultGosuCompileSpec createSpec() {
 DefaultGosuCompileSpec spec = new DefaultGosuCompileSpecFactory(_compileOptions).create();
 Project project = getProject();
 spec.setSource(getSource()); //project.files([ "src/main/gosu" ])
 spec.setSourceRoots(getSourceRoots());
 spec.setDestinationDir(getDestinationDir());
 spec.setClasspath(getClasspath());
 //Force gosu-core into the classpath. Normally it's a runtime dependency but compilation requires it.
 Set<ResolvedArtifact> projectDeps = project.getConfigurations().getByName("runtime").getResolvedConfiguration().getResolvedArtifacts();
 File gosuCore = GosuPlugin.getArtifactWithName("gosu-core", projectDeps).getFile();
 spec.setGosuClasspath( Collections.singletonList( gosuCore ) );
 if(LOGGER.isDebugEnabled()) {
  LOGGER.debug("Gosu Compiler Spec classpath is:");
  for(File file : spec.getClasspath()) {
   LOGGER.debug(file.getAbsolutePath());
  }
  LOGGER.debug("Gosu Compile Spec gosuClasspath is:");
  for(File file : spec.getGosuClasspath()) {
   LOGGER.debug(file.getAbsolutePath());
  }
 }
 return spec;
}

代码示例来源:origin: gradle.plugin.com.github.spotbugs/gradlePlugin

SpotBugsSpec generateSpec() {
  SpotBugsSpecBuilder specBuilder = new SpotBugsSpecBuilder(getClasses())
      .withPluginsList(getPluginClasspath())
      .withSources(getSource())
      .withClasspath(getClasspath())
      .withDebugging(getLogger().isDebugEnabled())
      .withEffort(getEffort())
      .withReportLevel(getReportLevel())
      .withMaxHeapSize(getMaxHeapSize())
      .withVisitors(getVisitors())
      .withOmitVisitors(getOmitVisitors())
      .withExcludeFilter(getExcludeFilter())
      .withIncludeFilter(getIncludeFilter())
      .withExcludeBugsFilter(getExcludeBugsFilter())
      .withExtraArgs(getExtraArgs())
      .configureReports(getReports());
  return specBuilder.build();
}

代码示例来源:origin: gradle.plugin.com.github.spotbugs/spotbugs-gradle-plugin

SpotBugsSpec generateSpec() {
  SpotBugsSpecBuilder specBuilder = new SpotBugsSpecBuilder(getClasses())
      .withPluginsList(getPluginClasspath())
      .withSources(getAllSource())
      .withClasspath(getClasspath())
      .withShowProgress(getShowProgress())
      .withDebugging(getLogger().isDebugEnabled())
      .withEffort(getEffort())
      .withReportLevel(getReportLevel())
      .withMaxHeapSize(getMaxHeapSize())
      .withVisitors(getVisitors())
      .withOmitVisitors(getOmitVisitors())
      .withExcludeFilter(getExcludeFilter())
      .withIncludeFilter(getIncludeFilter())
      .withExcludeBugsFilter(getExcludeBugsFilter())
      .withExtraArgs(getExtraArgs())
      .withJvmArgs(getJvmArgs())
      .configureReports(getReports());
  return specBuilder.build();
}

相关文章