From 46c0d75baf3e852175e2acf5e960af42149e2631 Mon Sep 17 00:00:00 2001 From: Jamie Tanna Date: Fri, 4 Feb 2022 11:36:03 +0000 Subject: [PATCH 1/5] Remove unused logger --- .../com/diffplug/spotless/glue/ktlint/KtlintFormatterFunc.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/src/ktlint/java/com/diffplug/spotless/glue/ktlint/KtlintFormatterFunc.java b/lib/src/ktlint/java/com/diffplug/spotless/glue/ktlint/KtlintFormatterFunc.java index 2147c22e90..8aa7510dc3 100644 --- a/lib/src/ktlint/java/com/diffplug/spotless/glue/ktlint/KtlintFormatterFunc.java +++ b/lib/src/ktlint/java/com/diffplug/spotless/glue/ktlint/KtlintFormatterFunc.java @@ -19,7 +19,6 @@ import java.util.Collections; import java.util.List; import java.util.Map; -import java.util.logging.Logger; import com.pinterest.ktlint.core.KtLint; import com.pinterest.ktlint.core.KtLint.Params; @@ -33,7 +32,6 @@ import kotlin.jvm.functions.Function2; public class KtlintFormatterFunc implements FormatterFunc.NeedsFile { - private static final Logger logger = Logger.getLogger(KtlintFormatterFunc.class.getName()); private final List rulesets; private final Map userData; From e9ead1f17ac9ccfbd2b2d7f9f3213b6bb1e89a5a Mon Sep 17 00:00:00 2001 From: Jamie Tanna Date: Fri, 4 Feb 2022 11:40:53 +0000 Subject: [PATCH 2/5] Migrate to SLF4J for logging As noted in #1116, it'd be ideal if we moved to SLF4J as our logging interface. We can do this pretty easily, making sure we remove our `package-list` reference, as well as making sure the SLF4J API is only used for compilation. We also need to map the error logging levels that most closely mirror what `java.util.logging` uses. Closes #1116. --- gradle/javadoc/java8/package-list | 1 - lib/build.gradle | 2 ++ .../spotless/glue/ktlint/KtlintFormatterFunc.java | 2 +- .../spotless/FormatExceptionPolicyLegacy.java | 12 ++++++------ .../diffplug/spotless/markdown/FreshMarkStep.java | 10 ++++++---- .../spotless/npm/NpmFormatterStepStateBase.java | 12 +++++++----- .../diffplug/spotless/npm/PrettierFormatterStep.java | 11 ++++++----- .../diffplug/spotless/npm/TsFmtFormatterStep.java | 11 ++++++----- .../spotless/glue/pom/SortPomFormatterFunc.java | 11 ++++++----- .../diffplug/gradle/spotless/GradleProvisioner.java | 11 +++++------ 10 files changed, 45 insertions(+), 38 deletions(-) diff --git a/gradle/javadoc/java8/package-list b/gradle/javadoc/java8/package-list index 351c186855..496d90dbfa 100644 --- a/gradle/javadoc/java8/package-list +++ b/gradle/javadoc/java8/package-list @@ -55,7 +55,6 @@ java.util.concurrent.atomic java.util.concurrent.locks java.util.function java.util.jar -java.util.logging java.util.prefs java.util.regex java.util.spi diff --git a/lib/build.gradle b/lib/build.gradle index 90d985ad69..b122cb42ee 100644 --- a/lib/build.gradle +++ b/lib/build.gradle @@ -21,6 +21,7 @@ for (glue in NEEDS_GLUE) { } dependencies { + compileOnly 'org.slf4j:slf4j-api:1.7.35' // zero runtime reqs is a hard requirements for spotless-lib // if you need a dep, put it in lib-extra testImplementation "org.junit.jupiter:junit-jupiter:$VER_JUNIT" @@ -29,6 +30,7 @@ dependencies { // used for pom sorting sortPomCompileOnly 'com.github.ekryd.sortpom:sortpom-sorter:3.0.0' + sortPomCompileOnly 'org.slf4j:slf4j-api:1.7.35' palantirJavaFormatCompileOnly 'com.palantir.javaformat:palantir-java-format:1.1.0' diff --git a/lib/src/ktlint/java/com/diffplug/spotless/glue/ktlint/KtlintFormatterFunc.java b/lib/src/ktlint/java/com/diffplug/spotless/glue/ktlint/KtlintFormatterFunc.java index 8aa7510dc3..061224a819 100644 --- a/lib/src/ktlint/java/com/diffplug/spotless/glue/ktlint/KtlintFormatterFunc.java +++ b/lib/src/ktlint/java/com/diffplug/spotless/glue/ktlint/KtlintFormatterFunc.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 DiffPlug + * Copyright 2021-2022 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/src/main/java/com/diffplug/spotless/FormatExceptionPolicyLegacy.java b/lib/src/main/java/com/diffplug/spotless/FormatExceptionPolicyLegacy.java index df95542a44..14f36da94e 100644 --- a/lib/src/main/java/com/diffplug/spotless/FormatExceptionPolicyLegacy.java +++ b/lib/src/main/java/com/diffplug/spotless/FormatExceptionPolicyLegacy.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 DiffPlug + * Copyright 2016-2022 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,13 +15,13 @@ */ package com.diffplug.spotless; -import java.util.logging.Level; -import java.util.logging.Logger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; class FormatExceptionPolicyLegacy extends NoLambda.EqualityBasedOnSerialization implements FormatExceptionPolicy { private static final long serialVersionUID = 1L; - private static final Logger logger = Logger.getLogger(Formatter.class.getName()); + private static final Logger logger = LoggerFactory.getLogger(Formatter.class.getName()); @Override public void handleError(Throwable e, FormatterStep step, String relativePath) { @@ -34,10 +34,10 @@ public void handleError(Throwable e, FormatterStep step, String relativePath) { } static void error(Throwable e, FormatterStep step, String relativePath) { - logger.log(Level.SEVERE, "Step '" + step.getName() + "' found problem in '" + relativePath + "':\n" + e.getMessage(), e); + logger.error("Step '" + step.getName() + "' found problem in '" + relativePath + "':\n" + e.getMessage(), e); } static void warning(Throwable e, FormatterStep step, String relativePath) { - logger.log(Level.WARNING, "Unable to apply step '" + step.getName() + "' to '" + relativePath + "'", e); + logger.warn("Unable to apply step '" + step.getName() + "' to '" + relativePath + "'", e); } } diff --git a/lib/src/main/java/com/diffplug/spotless/markdown/FreshMarkStep.java b/lib/src/main/java/com/diffplug/spotless/markdown/FreshMarkStep.java index 2190af88e7..d972dd9480 100644 --- a/lib/src/main/java/com/diffplug/spotless/markdown/FreshMarkStep.java +++ b/lib/src/main/java/com/diffplug/spotless/markdown/FreshMarkStep.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2021 DiffPlug + * Copyright 2016-2022 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,7 +24,9 @@ import java.util.Objects; import java.util.TreeMap; import java.util.function.Consumer; -import java.util.logging.Logger; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import com.diffplug.spotless.FormatterFunc; import com.diffplug.spotless.FormatterStep; @@ -78,8 +80,8 @@ private static class State implements Serializable { } FormatterFunc createFormat() throws Exception { - Logger logger = Logger.getLogger(FreshMarkStep.class.getName()); - Consumer loggingStream = logger::warning; + Logger logger = LoggerFactory.getLogger(FreshMarkStep.class.getName()); + Consumer loggingStream = logger::warn; ClassLoader classLoader = jarState.getClassLoader(); diff --git a/lib/src/main/java/com/diffplug/spotless/npm/NpmFormatterStepStateBase.java b/lib/src/main/java/com/diffplug/spotless/npm/NpmFormatterStepStateBase.java index 48bec00c8f..d8127d10d2 100644 --- a/lib/src/main/java/com/diffplug/spotless/npm/NpmFormatterStepStateBase.java +++ b/lib/src/main/java/com/diffplug/spotless/npm/NpmFormatterStepStateBase.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2021 DiffPlug + * Copyright 2016-2022 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,7 +27,9 @@ import java.util.Map.Entry; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; -import java.util.logging.Logger; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import com.diffplug.spotless.FileSignature; import com.diffplug.spotless.FormatterFunc; @@ -36,7 +38,7 @@ abstract class NpmFormatterStepStateBase implements Serializable { - private static final Logger logger = Logger.getLogger(NpmFormatterStepStateBase.class.getName()); + private static final Logger logger = LoggerFactory.getLogger(NpmFormatterStepStateBase.class.getName()); private static final long serialVersionUID = 1460749955865959948L; @@ -166,13 +168,13 @@ public String getBaseUrl() { @Override public void close() throws Exception { try { - logger.fine("Closing npm server in directory <" + serverPortFile.getParent() + "> and port <" + serverPort + ">"); + logger.trace("Closing npm server in directory <" + serverPortFile.getParent() + "> and port <" + serverPort + ">"); if (server.isAlive()) { boolean ended = server.waitFor(5, TimeUnit.SECONDS); if (!ended) { logger.info("Force-Closing npm server in directory <" + serverPortFile.getParent() + "> and port <" + serverPort + ">"); server.destroyForcibly().waitFor(); - logger.fine("Force-Closing npm server in directory <" + serverPortFile.getParent() + "> and port <" + serverPort + "> -- Finished"); + logger.trace("Force-Closing npm server in directory <" + serverPortFile.getParent() + "> and port <" + serverPort + "> -- Finished"); } } } finally { diff --git a/lib/src/main/java/com/diffplug/spotless/npm/PrettierFormatterStep.java b/lib/src/main/java/com/diffplug/spotless/npm/PrettierFormatterStep.java index 0cd0f5f558..a5183d2e9c 100644 --- a/lib/src/main/java/com/diffplug/spotless/npm/PrettierFormatterStep.java +++ b/lib/src/main/java/com/diffplug/spotless/npm/PrettierFormatterStep.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2021 DiffPlug + * Copyright 2016-2022 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,11 +23,12 @@ import java.util.Collections; import java.util.Map; import java.util.TreeMap; -import java.util.logging.Level; -import java.util.logging.Logger; import javax.annotation.Nonnull; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import com.diffplug.spotless.FormatterFunc; import com.diffplug.spotless.FormatterFunc.Closeable; import com.diffplug.spotless.FormatterStep; @@ -36,7 +37,7 @@ public class PrettierFormatterStep { - private static final Logger logger = Logger.getLogger(PrettierFormatterStep.class.getName()); + private static final Logger logger = LoggerFactory.getLogger(PrettierFormatterStep.class.getName()); public static final String NAME = "prettier-format"; @@ -95,7 +96,7 @@ private void endServer(PrettierRestService restService, ServerProcessInfo restSe try { restService.shutdown(); } catch (Throwable t) { - logger.log(Level.INFO, "Failed to request shutdown of rest service via api. Trying via process.", t); + logger.info("Failed to request shutdown of rest service via api. Trying via process.", t); } restServer.close(); } diff --git a/lib/src/main/java/com/diffplug/spotless/npm/TsFmtFormatterStep.java b/lib/src/main/java/com/diffplug/spotless/npm/TsFmtFormatterStep.java index a87bc0ebae..045c8a0df3 100644 --- a/lib/src/main/java/com/diffplug/spotless/npm/TsFmtFormatterStep.java +++ b/lib/src/main/java/com/diffplug/spotless/npm/TsFmtFormatterStep.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2021 DiffPlug + * Copyright 2016-2022 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,12 +21,13 @@ import java.io.IOException; import java.io.Serializable; import java.util.*; -import java.util.logging.Level; -import java.util.logging.Logger; import javax.annotation.Nonnull; import javax.annotation.Nullable; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import com.diffplug.spotless.FormatterFunc; import com.diffplug.spotless.FormatterFunc.Closeable; import com.diffplug.spotless.FormatterStep; @@ -35,7 +36,7 @@ public class TsFmtFormatterStep { - private static final Logger logger = Logger.getLogger(TsFmtFormatterStep.class.getName()); + private static final Logger logger = LoggerFactory.getLogger(TsFmtFormatterStep.class.getName()); public static final String NAME = "tsfmt-format"; @@ -115,7 +116,7 @@ private void endServer(TsFmtRestService restService, ServerProcessInfo restServe try { restService.shutdown(); } catch (Throwable t) { - logger.log(Level.INFO, "Failed to request shutdown of rest service via api. Trying via process.", t); + logger.info("Failed to request shutdown of rest service via api. Trying via process.", t); } restServer.close(); } diff --git a/lib/src/sortPom/java/com/diffplug/spotless/glue/pom/SortPomFormatterFunc.java b/lib/src/sortPom/java/com/diffplug/spotless/glue/pom/SortPomFormatterFunc.java index 4a72c48fa9..909e04e589 100644 --- a/lib/src/sortPom/java/com/diffplug/spotless/glue/pom/SortPomFormatterFunc.java +++ b/lib/src/sortPom/java/com/diffplug/spotless/glue/pom/SortPomFormatterFunc.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 DiffPlug + * Copyright 2021-2022 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,9 +18,10 @@ import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; -import java.util.logging.Logger; import org.apache.commons.io.IOUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import com.diffplug.spotless.FormatterFunc; import com.diffplug.spotless.pom.SortPomCfg; @@ -30,7 +31,7 @@ import sortpom.parameter.PluginParameters; public class SortPomFormatterFunc implements FormatterFunc { - private static final Logger logger = Logger.getLogger(SortPomFormatterFunc.class.getName()); + private static final Logger logger = LoggerFactory.getLogger(SortPomFormatterFunc.class.getName()); private final SortPomCfg cfg; public SortPomFormatterFunc(SortPomCfg cfg) { @@ -61,7 +62,7 @@ public String apply(String input) throws Exception { private static class MySortPomLogger implements SortPomLogger { @Override public void warn(String content) { - logger.warning(content); + logger.warn(content); } @Override @@ -71,7 +72,7 @@ public void info(String content) { @Override public void error(String content) { - logger.severe(content); + logger.error(content); } } } diff --git a/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/GradleProvisioner.java b/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/GradleProvisioner.java index 240ffcdcdf..7c005cd471 100644 --- a/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/GradleProvisioner.java +++ b/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/GradleProvisioner.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2021 DiffPlug + * Copyright 2016-2022 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,8 +20,6 @@ import java.util.HashMap; import java.util.Map; import java.util.Set; -import java.util.logging.Level; -import java.util.logging.Logger; import org.gradle.api.GradleException; import org.gradle.api.Project; @@ -30,6 +28,8 @@ import org.gradle.api.artifacts.dsl.DependencyHandler; import org.gradle.api.attributes.Bundling; import org.gradle.api.initialization.dsl.ScriptHandler; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import com.diffplug.common.base.Unhandled; import com.diffplug.common.collect.ImmutableList; @@ -127,8 +127,7 @@ private static Provisioner forConfigurationContainer(Project project, Configurat if (!projName.isEmpty()) { projName = projName + "/"; } - logger.log( - Level.SEVERE, + logger.error( "You need to add a repository containing the '" + mavenCoords + "' artifact in '" + projName + "build.gradle'.\n" + "E.g.: 'repositories { mavenCentral() }'", e); @@ -137,7 +136,7 @@ private static Provisioner forConfigurationContainer(Project project, Configurat }; } - private static final Logger logger = Logger.getLogger(GradleProvisioner.class.getName()); + private static final Logger logger = LoggerFactory.getLogger(GradleProvisioner.class.getName()); /** Models a request to the provisioner. */ private static class Request { From 166ab53bbe4d8cd0c510e954744c638304aa6d0a Mon Sep 17 00:00:00 2001 From: Jamie Tanna Date: Fri, 4 Feb 2022 11:50:25 +0000 Subject: [PATCH 3/5] Remove string concatenation from log messages As it removes unnecessary String concatenation at runtime, if the log levels aren't enabled. --- .../diffplug/spotless/FormatExceptionPolicyLegacy.java | 4 ++-- .../diffplug/spotless/npm/NpmFormatterStepStateBase.java | 8 +++++--- .../com/diffplug/gradle/spotless/GradleProvisioner.java | 3 ++- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/src/main/java/com/diffplug/spotless/FormatExceptionPolicyLegacy.java b/lib/src/main/java/com/diffplug/spotless/FormatExceptionPolicyLegacy.java index 14f36da94e..0b43ad961b 100644 --- a/lib/src/main/java/com/diffplug/spotless/FormatExceptionPolicyLegacy.java +++ b/lib/src/main/java/com/diffplug/spotless/FormatExceptionPolicyLegacy.java @@ -34,10 +34,10 @@ public void handleError(Throwable e, FormatterStep step, String relativePath) { } static void error(Throwable e, FormatterStep step, String relativePath) { - logger.error("Step '" + step.getName() + "' found problem in '" + relativePath + "':\n" + e.getMessage(), e); + logger.error("Step '{}' found problem in '{}':\n{}", step.getName(), relativePath, e.getMessage(), e); } static void warning(Throwable e, FormatterStep step, String relativePath) { - logger.warn("Unable to apply step '" + step.getName() + "' to '" + relativePath + "'", e); + logger.warn("Unable to apply step '{}' to '{}'", step.getName(), relativePath, e); } } diff --git a/lib/src/main/java/com/diffplug/spotless/npm/NpmFormatterStepStateBase.java b/lib/src/main/java/com/diffplug/spotless/npm/NpmFormatterStepStateBase.java index d8127d10d2..395a186ce1 100644 --- a/lib/src/main/java/com/diffplug/spotless/npm/NpmFormatterStepStateBase.java +++ b/lib/src/main/java/com/diffplug/spotless/npm/NpmFormatterStepStateBase.java @@ -168,13 +168,15 @@ public String getBaseUrl() { @Override public void close() throws Exception { try { - logger.trace("Closing npm server in directory <" + serverPortFile.getParent() + "> and port <" + serverPort + ">"); + logger.trace("Closing npm server in directory <{}> and port <{}>", + serverPortFile.getParent(), serverPort); + if (server.isAlive()) { boolean ended = server.waitFor(5, TimeUnit.SECONDS); if (!ended) { - logger.info("Force-Closing npm server in directory <" + serverPortFile.getParent() + "> and port <" + serverPort + ">"); + logger.info("Force-Closing npm server in directory <{}> and port <{}>", serverPortFile.getParent(), serverPort); server.destroyForcibly().waitFor(); - logger.trace("Force-Closing npm server in directory <" + serverPortFile.getParent() + "> and port <" + serverPort + "> -- Finished"); + logger.trace("Force-Closing npm server in directory <{}> and port <{}> -- Finished", serverPortFile.getParent(), serverPort); } } } finally { diff --git a/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/GradleProvisioner.java b/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/GradleProvisioner.java index 7c005cd471..bce04380c5 100644 --- a/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/GradleProvisioner.java +++ b/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/GradleProvisioner.java @@ -128,8 +128,9 @@ private static Provisioner forConfigurationContainer(Project project, Configurat projName = projName + "/"; } logger.error( - "You need to add a repository containing the '" + mavenCoords + "' artifact in '" + projName + "build.gradle'.\n" + + "You need to add a repository containing the '{}' artifact in '{}build.gradle'.\n" + "E.g.: 'repositories { mavenCentral() }'", + mavenCoords, projName, e); throw e; } From a8b01b808a3f57dda08d2b92cc7500f1cc0ea006 Mon Sep 17 00:00:00 2001 From: Jamie Tanna Date: Sun, 6 Feb 2022 13:12:53 +0000 Subject: [PATCH 4/5] Update CHANGES with SLF4J logging changes --- CHANGES.md | 4 ++++ plugin-gradle/CHANGES.md | 4 ++++ plugin-maven/CHANGES.md | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 29fd6d9375..508fee230a 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -11,6 +11,10 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format ( ## [Unreleased] +### Changed + +* Use SLF4J for logging ([#1116](https://github.com/diffplug/spotless/issues/1116)) + ## [2.22.2] - 2022-02-09 ### Changed * Bump default ktfmt `0.30` -> `0.31` ([#1118](https://github.com/diffplug/spotless/pull/1118)). diff --git a/plugin-gradle/CHANGES.md b/plugin-gradle/CHANGES.md index 6c2a6cd4da..3c01b42312 100644 --- a/plugin-gradle/CHANGES.md +++ b/plugin-gradle/CHANGES.md @@ -4,6 +4,10 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format ( ## [Unreleased] +### Changed + +* Use SLF4J for logging ([#1116](https://github.com/diffplug/spotless/issues/1116)) + ## [6.2.2] - 2022-02-09 ### Changed * Bump default ktfmt `0.30` -> `0.31` ([#1118](https://github.com/diffplug/spotless/pull/1118)). diff --git a/plugin-maven/CHANGES.md b/plugin-maven/CHANGES.md index 8d277d1703..4bf305b5e3 100644 --- a/plugin-maven/CHANGES.md +++ b/plugin-maven/CHANGES.md @@ -4,6 +4,10 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format ( ## [Unreleased] +### Changed + +* Use SLF4J for logging ([#1116](https://github.com/diffplug/spotless/issues/1116)) + ## [2.20.2] - 2022-02-09 ### Changed * Bump default ktfmt `0.30` -> `0.31` ([#1118](https://github.com/diffplug/spotless/pull/1118)). From 85d15b59113944fb133e8445ec8bb8a7d591f6c6 Mon Sep 17 00:00:00 2001 From: Jamie Tanna Date: Tue, 15 Feb 2022 09:21:53 +0000 Subject: [PATCH 5/5] Remove unnecessary `.getName()`s on logger creation As SLF4J allows passing in a `Class`, instead of a `String` for the class name, we can simplify interactions with the logger creations. --- .../java/com/diffplug/spotless/FormatExceptionPolicyLegacy.java | 2 +- .../main/java/com/diffplug/spotless/markdown/FreshMarkStep.java | 2 +- .../com/diffplug/spotless/npm/NpmFormatterStepStateBase.java | 2 +- .../java/com/diffplug/spotless/npm/PrettierFormatterStep.java | 2 +- .../main/java/com/diffplug/spotless/npm/TsFmtFormatterStep.java | 2 +- .../com/diffplug/spotless/glue/pom/SortPomFormatterFunc.java | 2 +- .../java/com/diffplug/gradle/spotless/GradleProvisioner.java | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/src/main/java/com/diffplug/spotless/FormatExceptionPolicyLegacy.java b/lib/src/main/java/com/diffplug/spotless/FormatExceptionPolicyLegacy.java index 0b43ad961b..93ca5d05b6 100644 --- a/lib/src/main/java/com/diffplug/spotless/FormatExceptionPolicyLegacy.java +++ b/lib/src/main/java/com/diffplug/spotless/FormatExceptionPolicyLegacy.java @@ -21,7 +21,7 @@ class FormatExceptionPolicyLegacy extends NoLambda.EqualityBasedOnSerialization implements FormatExceptionPolicy { private static final long serialVersionUID = 1L; - private static final Logger logger = LoggerFactory.getLogger(Formatter.class.getName()); + private static final Logger logger = LoggerFactory.getLogger(Formatter.class); @Override public void handleError(Throwable e, FormatterStep step, String relativePath) { diff --git a/lib/src/main/java/com/diffplug/spotless/markdown/FreshMarkStep.java b/lib/src/main/java/com/diffplug/spotless/markdown/FreshMarkStep.java index d972dd9480..2591cac7a5 100644 --- a/lib/src/main/java/com/diffplug/spotless/markdown/FreshMarkStep.java +++ b/lib/src/main/java/com/diffplug/spotless/markdown/FreshMarkStep.java @@ -80,7 +80,7 @@ private static class State implements Serializable { } FormatterFunc createFormat() throws Exception { - Logger logger = LoggerFactory.getLogger(FreshMarkStep.class.getName()); + Logger logger = LoggerFactory.getLogger(FreshMarkStep.class); Consumer loggingStream = logger::warn; ClassLoader classLoader = jarState.getClassLoader(); diff --git a/lib/src/main/java/com/diffplug/spotless/npm/NpmFormatterStepStateBase.java b/lib/src/main/java/com/diffplug/spotless/npm/NpmFormatterStepStateBase.java index 395a186ce1..2e8d80e471 100644 --- a/lib/src/main/java/com/diffplug/spotless/npm/NpmFormatterStepStateBase.java +++ b/lib/src/main/java/com/diffplug/spotless/npm/NpmFormatterStepStateBase.java @@ -38,7 +38,7 @@ abstract class NpmFormatterStepStateBase implements Serializable { - private static final Logger logger = LoggerFactory.getLogger(NpmFormatterStepStateBase.class.getName()); + private static final Logger logger = LoggerFactory.getLogger(NpmFormatterStepStateBase.class); private static final long serialVersionUID = 1460749955865959948L; diff --git a/lib/src/main/java/com/diffplug/spotless/npm/PrettierFormatterStep.java b/lib/src/main/java/com/diffplug/spotless/npm/PrettierFormatterStep.java index a5183d2e9c..49d692d62c 100644 --- a/lib/src/main/java/com/diffplug/spotless/npm/PrettierFormatterStep.java +++ b/lib/src/main/java/com/diffplug/spotless/npm/PrettierFormatterStep.java @@ -37,7 +37,7 @@ public class PrettierFormatterStep { - private static final Logger logger = LoggerFactory.getLogger(PrettierFormatterStep.class.getName()); + private static final Logger logger = LoggerFactory.getLogger(PrettierFormatterStep.class); public static final String NAME = "prettier-format"; diff --git a/lib/src/main/java/com/diffplug/spotless/npm/TsFmtFormatterStep.java b/lib/src/main/java/com/diffplug/spotless/npm/TsFmtFormatterStep.java index 045c8a0df3..14080ecf56 100644 --- a/lib/src/main/java/com/diffplug/spotless/npm/TsFmtFormatterStep.java +++ b/lib/src/main/java/com/diffplug/spotless/npm/TsFmtFormatterStep.java @@ -36,7 +36,7 @@ public class TsFmtFormatterStep { - private static final Logger logger = LoggerFactory.getLogger(TsFmtFormatterStep.class.getName()); + private static final Logger logger = LoggerFactory.getLogger(TsFmtFormatterStep.class); public static final String NAME = "tsfmt-format"; diff --git a/lib/src/sortPom/java/com/diffplug/spotless/glue/pom/SortPomFormatterFunc.java b/lib/src/sortPom/java/com/diffplug/spotless/glue/pom/SortPomFormatterFunc.java index 909e04e589..22a0249634 100644 --- a/lib/src/sortPom/java/com/diffplug/spotless/glue/pom/SortPomFormatterFunc.java +++ b/lib/src/sortPom/java/com/diffplug/spotless/glue/pom/SortPomFormatterFunc.java @@ -31,7 +31,7 @@ import sortpom.parameter.PluginParameters; public class SortPomFormatterFunc implements FormatterFunc { - private static final Logger logger = LoggerFactory.getLogger(SortPomFormatterFunc.class.getName()); + private static final Logger logger = LoggerFactory.getLogger(SortPomFormatterFunc.class); private final SortPomCfg cfg; public SortPomFormatterFunc(SortPomCfg cfg) { diff --git a/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/GradleProvisioner.java b/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/GradleProvisioner.java index bce04380c5..4ef8521412 100644 --- a/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/GradleProvisioner.java +++ b/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/GradleProvisioner.java @@ -137,7 +137,7 @@ private static Provisioner forConfigurationContainer(Project project, Configurat }; } - private static final Logger logger = LoggerFactory.getLogger(GradleProvisioner.class.getName()); + private static final Logger logger = LoggerFactory.getLogger(GradleProvisioner.class); /** Models a request to the provisioner. */ private static class Request {