org.gradle.api.logging.Logger类的使用及代码示例

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

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

Logger介绍

[英]An extension to the SLF4J Logger interface, which adds the quiet and lifecycle log levels.

You can obtain a Logger instance using Logging#getLogger(Class) or Logging#getLogger(String). A Logger instance is also available through org.gradle.api.Project#getLogger(), org.gradle.api.Task#getLogger() and org.gradle.api.Script#getLogger().
[中]SLF4J记录器接口的扩展,增加了静默和生命周期日志级别。
您可以使用Logging#getLogger(类)或Logging#getLogger(字符串)获取记录器实例。记录器实例也可通过org获得。格拉德尔。应用程序编程接口。项目#getLogger(),org。格拉德尔。应用程序编程接口。任务#getLogger()和组织。格拉德尔。应用程序编程接口。脚本#getLogger()。

代码示例

代码示例来源:origin: linkedin/rest.li

  1. @TaskAction
  2. public void checkFilesForChanges(IncrementalTaskInputs inputs)
  3. getLogger().lifecycle("Checking idl and snapshot files for changes...");
  4. getLogger().info("idlFiles: " + idlFiles.getAsPath());
  5. getLogger().info("snapshotFiles: " + snapshotFiles.getAsPath());
  6. getLogger().lifecycle(
  7. "The following files have been removed, be sure to remove them from source control: {}", files);
  8. getLogger().lifecycle("The following files have been added, be sure to add them to source control: {}", files);
  9. getLogger().lifecycle(
  10. "The following files have been changed, be sure to commit the changes to source control: {}", files);

代码示例来源:origin: hibernate/hibernate-orm

  1. @Override
  2. public void execute(Task task) {
  3. project.getLogger().debug( "Starting Hibernate enhancement on SourceSet.{}", sourceSet.getName() );
  4. logger.warn("Extended enhancement is enabled. Classes other than entities may be modified. You should consider access the entities using getter/setter methods and disable this property. Use at your own risk." );
  5. if ( enhancedBytecode != null ) {
  6. writeOutEnhancedClass( enhancedBytecode, file );
  7. logger.info( "Successfully enhanced class [" + file + "]" );
  8. logger.info( "Skipping class [" + file.getAbsolutePath() + "], not an entity nor embeddable" );

代码示例来源:origin: hibernate/hibernate-orm

  1. if ( file.delete() ) {
  2. if ( !file.createNewFile() ) {
  3. logger.error( "Unable to recreate class file [" + file.getName() + "]" );
  4. logger.error( "Unable to delete class file [" + file.getName() + "]" );
  5. logger.warn( "Problem preparing class file for writing out enhancements [" + file.getName() + "]" );

代码示例来源:origin: jooby-project/jooby

  1. output.mkdirs();
  2. logger.debug("claspath: " + loader);
  3. logger.debug("assets.conf: " + assetConf.getConfig("assets"));
  4. CharSequence summary = compiler
  5. .summary(fileset, output.toPath(), env, end - start, " " + assemblyOutput, "Assets: " + distFile);
  6. logger.info(summary.toString());
  7. .toFile();
  8. to.getParentFile().mkdirs();
  9. logger.debug("copying file to: " + to);
  10. Files.copy(from, to);

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

  1. private void setState(ExecHandleState state) {
  2. lock.lock();
  3. try {
  4. LOGGER.debug("Changing state to: {}", state);
  5. this.state = state;
  6. this.stateChanged.signalAll();
  7. } finally {
  8. lock.unlock();
  9. }
  10. }

代码示例来源:origin: linkedin/rest.li

  1. LOG.info("Compiling Scala resource classes. Disabling pathing jar for " + taskName + " to avoid breaking Scala compilation");
  2. return classpath;

代码示例来源:origin: gradle.plugin.com.we.intershop.gradleplugin/icm-code-generator

  1. public void writeImplementation(String name, String data) {
  2. logger.debug("writing Implementatio data : {}", data);
  3. try {
  4. Files.write(this.internalPath.resolve(name), data.getBytes());
  5. } catch (IOException e) {
  6. logger.error("error writing Implementatio ", e);
  7. }
  8. }

代码示例来源:origin: hibernate/hibernate-orm

  1. private ClassLoader toClassLoader(FileCollection runtimeClasspath) {
  2. List<URL> urls = new ArrayList<URL>();
  3. for ( File file : runtimeClasspath ) {
  4. try {
  5. urls.add( file.toURI().toURL() );
  6. logger.debug( "Adding classpath entry for " + file.getAbsolutePath() );
  7. }
  8. catch (MalformedURLException e) {
  9. throw new GradleException( "Unable to resolve classpath entry to URL : " + file.getAbsolutePath(), e );
  10. }
  11. }
  12. return new URLClassLoader( urls.toArray( new URL[urls.size()] ), Enhancer.class.getClassLoader() );
  13. }

代码示例来源:origin: diffplug/spotless

  1. /** Makes it possible to remove a format which was created earlier. */
  2. public void removeFormat(String name) {
  3. requireNonNull(name);
  4. FormatExtension toRemove = formats.remove(name);
  5. if (toRemove == null) {
  6. project.getLogger().warn("Called removeFormat('" + name + "') but there was no such format.");
  7. }
  8. }

代码示例来源:origin: junkdog/artemis-odb

  1. @Override
  2. public void error(String msg) {
  3. log.error(msg);
  4. }
  5. };

代码示例来源:origin: net.corda.plugins/api-scanner

  1. void scan(File source) {
  2. File target = toTarget(source);
  3. getLogger().info("API file: {}", target.getAbsolutePath());
  4. try (
  5. URLClassLoader appLoader = new URLClassLoader(new URL[]{toURL(source)}, classpathLoader);
  6. ApiPrintWriter writer = new ApiPrintWriter(target, "UTF-8")
  7. ) {
  8. scan(writer, appLoader);
  9. } catch (IOException e) {
  10. getLogger().error("API scan has failed", e);
  11. }
  12. }

代码示例来源:origin: palantir/gradle-baseline

  1. private static File rootVersionsPropsFile(Project project) {
  2. File file = project.getRootProject().file("versions.props");
  3. if (!file.canRead()) {
  4. try {
  5. log.info("Could not find 'versions.props' file, creating...");
  6. Files.createFile(file.toPath());
  7. } catch (IOException e) {
  8. log.warn("Unable to create empty versions.props file, please create this manually", e);
  9. }
  10. }
  11. return file;
  12. }

代码示例来源: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: linkedin/rest.li

  1. @Override
  2. public void write(int b)
  3. throws IOException
  4. {
  5. wholeTextBuilder.append((char) b);
  6. if (b == '\n')
  7. {
  8. LOG.lifecycle("[checker] {}", lineTextBuilder.toString());
  9. processLine(lineTextBuilder.toString());
  10. lineTextBuilder = new StringBuilder();
  11. }
  12. else
  13. {
  14. lineTextBuilder.append((char) b);
  15. }
  16. }

代码示例来源:origin: gradle.plugin.de.heinrichmarkus.gradle/dbp

  1. @TaskAction
  2. public void compile() {
  3. if (!msbuildConfiguration.getItems().isEmpty()) {
  4. getLogger().lifecycle("Compiling with BDS " + bds.get());
  5. for (MsbuildItem p : msbuildConfiguration.getItems()) {
  6. getLogger().lifecycle(String.format("\t- %s", p.toString()));
  7. compileProject(p);
  8. }
  9. } else {
  10. getLogger().warn("Nothing to compile! Add project files to project.dproj property.");
  11. }
  12. }

代码示例来源:origin: hibernate/hibernate-orm

  1. private void applyEnhancement(final Project project, final HibernateExtension hibernateExtension) {
  2. if ( !hibernateExtension.enhance.shouldApply() ) {
  3. project.getLogger().warn( "Skipping Hibernate bytecode enhancement since no feature is enabled" );
  4. return;
  5. project.getLogger().debug( "Applying Hibernate enhancement action to SourceSet.{}", sourceSet.getName() );

代码示例来源: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: org.gradle/gradle-core

  1. public void projectsLoaded(Gradle gradle) {
  2. if (logger.isInfoEnabled()) {
  3. ProjectInternal projectInternal = (ProjectInternal) gradle.getRootProject();
  4. logger.info("Projects loaded. Root project using {}.",
  5. projectInternal.getBuildScriptSource().getDisplayName());
  6. logger.info("Included projects: {}", projectInternal.getAllprojects());
  7. }
  8. }

代码示例来源: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 void abortProcess() {
  2. lock.lock();
  3. try {
  4. aborted = true;
  5. if (process != null) {
  6. LOGGER.debug("Abort requested. Destroying process: {}.", execHandle.getDisplayName());
  7. process.destroy();
  8. }
  9. } finally {
  10. lock.unlock();
  11. }
  12. }

相关文章