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

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

本文整理了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

  1. private void beforeMethod(MethodInvocation methodInvocation) {
  2. if (!LOGGER.isDebugEnabled()) {
  3. return;
  4. }
  5. Object target = methodInvocation.getThis();
  6. Object[] arguments = methodInvocation.getArguments();
  7. Method method = methodInvocation.getMethod();
  8. LOGGER.debug("Entering method {} of class {}, the arguments is {}",
  9. method.getName(), target.getClass().getSimpleName(),
  10. toString(arguments));
  11. }

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

  1. @Override
  2. public void discardTypesFrom(ClassLoader classLoader) {
  3. if (classLoader == leakingLoader) {
  4. throw new IllegalStateException("Cannot remove own types from Groovy loader.");
  5. }
  6. // Remove cached value for every class seen by this ClassLoader that was loaded by the given ClassLoader
  7. try {
  8. Iterator<?> it = globalClassSetIterator();
  9. while (it.hasNext()) {
  10. Object classInfo = it.next();
  11. if (classInfo != null) {
  12. Class clazz = (Class) clazzField.get(classInfo);
  13. if (clazz.getClassLoader() == classLoader) {
  14. removeFromGlobalClassValue.invoke(globalClassValue, clazz);
  15. if (LOG.isDebugEnabled()) {
  16. LOG.debug("Removed ClassInfo from {} loaded by {}", clazz.getName(), clazz.getClassLoader());
  17. }
  18. }
  19. }
  20. }
  21. } catch (Exception e) {
  22. throw new GradleException("Could not remove types for ClassLoader " + classLoader + " from the Groovy system " + leakingLoader, e);
  23. }
  24. }

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

  1. @Override
  2. public void shutdown() {
  3. if (leakingLoader == getClass().getClassLoader()) {
  4. throw new IllegalStateException("Cannot shut down the main Groovy loader.");
  5. }
  6. // Remove cached value for every class seen by this ClassLoader
  7. try {
  8. Iterator<?> it = globalClassSetIterator();
  9. while (it.hasNext()) {
  10. Object classInfo = it.next();
  11. if (classInfo != null) {
  12. Class clazz = (Class) clazzField.get(classInfo);
  13. removeFromGlobalClassValue.invoke(globalClassValue, clazz);
  14. if (LOG.isDebugEnabled()) {
  15. LOG.debug("Removed ClassInfo from {} loaded by {}", clazz.getName(), clazz.getClassLoader());
  16. }
  17. }
  18. }
  19. } catch (Exception e) {
  20. throw new GradleException("Could not shut down the Groovy system for " + leakingLoader, e);
  21. }
  22. }

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

  1. protected BuildOperationLogInfo createLogInfo(String taskName, File outputFile, int maximumFailures) {
  2. final BuildOperationLogInfo configuration;
  3. if (logger.isDebugEnabled()) {
  4. // show all operation output when debug is enabled
  5. configuration = new BuildOperationLogInfo(taskName, outputFile, Integer.MAX_VALUE);
  6. } else {
  7. configuration = new BuildOperationLogInfo(taskName, outputFile, maximumFailures);
  8. }
  9. return configuration;
  10. }
  11. }

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

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

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

  1. private void afterMethod(MethodInvocation methodInvocation, Object returnValue, Throwable e, long nanoseconds) {
  2. if (!LOGGER.isDebugEnabled()) {
  3. return;
  4. }
  5. Object target = methodInvocation.getThis();
  6. Method method = methodInvocation.getMethod();
  7. if (e == null) {
  8. LOGGER.debug("Exiting method {} of class {}, total time is {} ms, return {}",
  9. method.getName(),
  10. target.getClass().getSimpleName(),
  11. toString(nanoseconds),
  12. returnValue);
  13. } else {
  14. LOGGER.debug("Exiting method {} of class {}, total time is {} ms, exception is {}",
  15. method.getName(),
  16. target.getClass().getSimpleName(),
  17. toString(nanoseconds),
  18. toString(e));
  19. }
  20. }

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

  1. private List<String> wsImportArgumentsFor( Wsdl wsdl ) {
  2. File wsdlFile = getProject().file( wsdl.getWsdl() );
  3. List<String> arguments = new ArrayList<>();
  4. if( wsdl.getPackageName() != null ) {
  5. arguments.add( "-p" );
  6. arguments.add( wsdl.getPackageName() );
  7. }
  8. arguments.add( "-wsdllocation" );
  9. arguments.add( wsdlFile.getName() );
  10. arguments.add( "-s" );
  11. arguments.add( outputDirectory.getAbsolutePath() );
  12. arguments.add( "-extension" );
  13. arguments.add( "-Xnocompile" );
  14. if (wsdl.getExtraArgs() != null) {
  15. arguments.addAll(Arrays.asList(wsdl.getExtraArgs().split(" ")));
  16. }
  17. if( getProject().getLogger().isDebugEnabled() ) {
  18. arguments.add( "-Xdebug" );
  19. } else {
  20. arguments.add( "-quiet" );
  21. }
  22. arguments.add( wsdlFile.getAbsolutePath() );
  23. return arguments;
  24. }

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

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

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

  1. private void removeCacheEntry(ClassPath key, Cleanup entry, Cleanup.Mode mode) {
  2. if (LOG.isDebugEnabled()) {
  3. LOG.debug("Removing classloader from cache, classpath = {}", key.getAsURIs());
  4. }
  5. lock.lock();
  6. try {
  7. cacheEntries.remove(key);
  8. cleanups.remove(key);
  9. } finally {
  10. lock.unlock();
  11. }
  12. try {
  13. entry.clear();
  14. entry.cleanup(mode);
  15. } catch (Exception ex) {
  16. LOG.error("Unable to perform cleanup of classloader for classpath: "+key, ex);
  17. }
  18. }

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

  1. private LogLevel getLogLevel() {
  2. if(logger.isTraceEnabled()) {
  3. return LogLevel.TRACE;
  4. } else if(logger.isDebugEnabled()) {
  5. return LogLevel.DEBUG;
  6. } else if(logger.isInfoEnabled()) {
  7. return LogLevel.INFO;
  8. } else if(logger.isLifecycleEnabled() || logger.isWarnEnabled()) {
  9. return LogLevel.WARN;
  10. }
  11. // QUIET or ERROR
  12. return LogLevel.ERROR;
  13. }

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

  1. public void run() {
  2. final AtomicLong busy = new AtomicLong(0);
  3. Timer totalTimer = Time.startTimer();
  4. final Timer taskTimer = Time.startTimer();
  5. WorkerLease childLease = parentWorkerLease.createChild();
  6. boolean moreTasksToExecute = true;
  7. while (moreTasksToExecute) {
  8. moreTasksToExecute = taskExecutionPlan.executeWithTask(childLease, new Action<TaskInfo>() {
  9. @Override
  10. public void execute(TaskInfo task) {
  11. final String taskPath = task.getTask().getPath();
  12. LOGGER.info("{} ({}) started.", taskPath, Thread.currentThread());
  13. taskTimer.reset();
  14. processTask(task);
  15. long taskDuration = taskTimer.getElapsedMillis();
  16. busy.addAndGet(taskDuration);
  17. if (LOGGER.isInfoEnabled()) {
  18. LOGGER.info("{} ({}) completed. Took {}.", taskPath, Thread.currentThread(), TimeFormatting.formatDurationVerbose(taskDuration));
  19. }
  20. }
  21. });
  22. }
  23. long total = totalTimer.getElapsedMillis();
  24. if (LOGGER.isDebugEnabled()) {
  25. LOGGER.debug("Task worker [{}] finished, busy: {}, idle: {}", Thread.currentThread(), TimeFormatting.formatDurationVerbose(busy.get()), TimeFormatting.formatDurationVerbose(total - busy.get()));
  26. }
  27. }

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

  1. @TaskAction
  2. public void run() {
  3. Map<String, String> properties = getProperties();
  4. if (properties.isEmpty()) {
  5. LOGGER.warn("Skipping SonarQube analysis: no properties configured, was it skipped in all projects?");
  6. return;
  7. }
  8. if (LOGGER.isDebugEnabled()) {
  9. properties.put("sonar.verbose", "true");
  10. }
  11. if (isSkippedWithProperty(properties)) {
  12. return;
  13. }
  14. EmbeddedScanner scanner = EmbeddedScanner.create("ScannerGradle", getPluginVersion() + "/" + getProject().getGradle().getGradleVersion(), LOG_OUTPUT)
  15. .addGlobalProperties(properties);
  16. scanner.start();
  17. scanner.execute(new HashMap<>());
  18. }

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

  1. @TaskAction
  2. public void run() {
  3. Map<String, String> properties = getProperties();
  4. if (properties.isEmpty()) {
  5. LOGGER.warn("Skipping SonarQube analysis: no properties configured, was it skipped in all projects?");
  6. return;
  7. }
  8. if (LOGGER.isDebugEnabled()) {
  9. properties.put("sonar.verbose", "true");
  10. }
  11. if (isSkippedWithProperty(properties)) {
  12. return;
  13. }
  14. EmbeddedScanner scanner = EmbeddedScanner.create("ScannerGradle", getPluginVersion() + "/" + getProject().getGradle().getGradleVersion(), LOG_OUTPUT)
  15. .addGlobalProperties(properties);
  16. scanner.start();
  17. scanner.execute(new HashMap<>());
  18. }

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

  1. @Override
  2. public String call() throws Exception {
  3. String logLevel = null;
  4. Logger logger = getLogger();
  5. if (logger.isTraceEnabled()) {
  6. logLevel = "silly";
  7. }
  8. else if (logger.isDebugEnabled()) {
  9. logLevel = "verbose";
  10. }
  11. else if (logger.isInfoEnabled()) {
  12. logLevel = "info";
  13. }
  14. else if (logger.isWarnEnabled()) {
  15. logLevel = "warn";
  16. }
  17. else if (logger.isErrorEnabled()) {
  18. logLevel = "error";
  19. }
  20. return logLevel;
  21. }

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

  1. @Override
  2. public String call() throws Exception {
  3. String logLevel = null;
  4. Logger logger = getLogger();
  5. if (logger.isTraceEnabled()) {
  6. logLevel = "silly";
  7. }
  8. else if (logger.isDebugEnabled()) {
  9. logLevel = "verbose";
  10. }
  11. else if (logger.isInfoEnabled()) {
  12. logLevel = "info";
  13. }
  14. else if (logger.isWarnEnabled()) {
  15. logLevel = "warn";
  16. }
  17. else if (logger.isErrorEnabled()) {
  18. logLevel = "error";
  19. }
  20. return logLevel;
  21. }

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

  1. private Task createClassycleTask(final Project project, final ClassycleExtension extension, final SourceSet sourceSet) {
  2. final String taskName = sourceSet.getTaskName("classycle", null);
  3. final FileCollection classesDirs = sourceSet.getOutput().getClassesDirs();
  4. final File reportFile = getReportingExtension(project).file("classycle_" + sourceSet.getName() + ".txt");
  5. final Task task = project.task(taskName);
  6. task.getInputs().files(classesDirs, extension.getDefinitionFile());
  7. task.getOutputs().file(reportFile);
  8. task.doLast(new ClassyclePlugin.ClassycleAction(classesDirs, reportFile, extension));
  9. // the classycle task depends on the corresponding classes task
  10. final String classesTask = sourceSet.getClassesTaskName();
  11. task.dependsOn(classesTask);
  12. if (project.getLogger().isDebugEnabled()) {
  13. final StringBuilder sb = new StringBuilder();
  14. for (final File file : classesDirs) {
  15. sb.append(file.getAbsolutePath()).append(" ");
  16. }
  17. project.getLogger()
  18. .debug("Created classycle task: " + taskName + ", report file: " + reportFile + ", depends on: "
  19. + classesTask + " - sourceSetDirs: " + sb.toString());
  20. }
  21. return task;
  22. }

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

  1. public void buildStarted(Gradle gradle) {
  2. StartParameter startParameter = gradle.getStartParameter();
  3. logger.info("Starting Build");
  4. if (logger.isDebugEnabled()) {
  5. logger.debug("Gradle user home: {}", startParameter.getGradleUserHomeDir());
  6. logger.debug("Current dir: {}", startParameter.getCurrentDir());
  7. logger.debug("Settings file: {}", startParameter.getSettingsFile());
  8. logger.debug("Build file: {}", startParameter.getBuildFile());
  9. }
  10. }

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

  1. private DefaultGosuCompileSpec createSpec() {
  2. DefaultGosuCompileSpec spec = new DefaultGosuCompileSpecFactory(_compileOptions).create();
  3. Project project = getProject();
  4. spec.setSource(getSource()); //project.files([ "src/main/gosu" ])
  5. spec.setSourceRoots(getSourceRoots());
  6. spec.setDestinationDir(getDestinationDir());
  7. spec.setClasspath(getClasspath());
  8. //Force gosu-core into the classpath. Normally it's a runtime dependency but compilation requires it.
  9. Set<ResolvedArtifact> projectDeps = project.getConfigurations().getByName("runtime").getResolvedConfiguration().getResolvedArtifacts();
  10. File gosuCore = GosuPlugin.getArtifactWithName("gosu-core", projectDeps).getFile();
  11. spec.setGosuClasspath( Collections.singletonList( gosuCore ) );
  12. if(LOGGER.isDebugEnabled()) {
  13. LOGGER.debug("Gosu Compiler Spec classpath is:");
  14. for(File file : spec.getClasspath()) {
  15. LOGGER.debug(file.getAbsolutePath());
  16. }
  17. LOGGER.debug("Gosu Compile Spec gosuClasspath is:");
  18. for(File file : spec.getGosuClasspath()) {
  19. LOGGER.debug(file.getAbsolutePath());
  20. }
  21. }
  22. return spec;
  23. }

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

  1. SpotBugsSpec generateSpec() {
  2. SpotBugsSpecBuilder specBuilder = new SpotBugsSpecBuilder(getClasses())
  3. .withPluginsList(getPluginClasspath())
  4. .withSources(getSource())
  5. .withClasspath(getClasspath())
  6. .withDebugging(getLogger().isDebugEnabled())
  7. .withEffort(getEffort())
  8. .withReportLevel(getReportLevel())
  9. .withMaxHeapSize(getMaxHeapSize())
  10. .withVisitors(getVisitors())
  11. .withOmitVisitors(getOmitVisitors())
  12. .withExcludeFilter(getExcludeFilter())
  13. .withIncludeFilter(getIncludeFilter())
  14. .withExcludeBugsFilter(getExcludeBugsFilter())
  15. .withExtraArgs(getExtraArgs())
  16. .configureReports(getReports());
  17. return specBuilder.build();
  18. }

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

  1. SpotBugsSpec generateSpec() {
  2. SpotBugsSpecBuilder specBuilder = new SpotBugsSpecBuilder(getClasses())
  3. .withPluginsList(getPluginClasspath())
  4. .withSources(getAllSource())
  5. .withClasspath(getClasspath())
  6. .withShowProgress(getShowProgress())
  7. .withDebugging(getLogger().isDebugEnabled())
  8. .withEffort(getEffort())
  9. .withReportLevel(getReportLevel())
  10. .withMaxHeapSize(getMaxHeapSize())
  11. .withVisitors(getVisitors())
  12. .withOmitVisitors(getOmitVisitors())
  13. .withExcludeFilter(getExcludeFilter())
  14. .withIncludeFilter(getIncludeFilter())
  15. .withExcludeBugsFilter(getExcludeBugsFilter())
  16. .withExtraArgs(getExtraArgs())
  17. .withJvmArgs(getJvmArgs())
  18. .configureReports(getReports());
  19. return specBuilder.build();
  20. }

相关文章