diff options
293 files changed, 849 insertions, 831 deletions
diff --git a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/coverage/AbstractCoverageSensor.java b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/coverage/AbstractCoverageSensor.java index 9b6c3823073..1aad073ff5f 100644 --- a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/coverage/AbstractCoverageSensor.java +++ b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/coverage/AbstractCoverageSensor.java @@ -31,12 +31,12 @@ import org.sonar.api.batch.sensor.Sensor; import org.sonar.api.batch.sensor.SensorContext; import org.sonar.api.batch.sensor.SensorDescriptor; import org.sonar.api.batch.sensor.coverage.NewCoverage; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.xoo.Xoo; public abstract class AbstractCoverageSensor implements Sensor { - private static final Logger LOG = Loggers.get(AbstractCoverageSensor.class); + private static final Logger LOG = LoggerFactory.getLogger(AbstractCoverageSensor.class); private void processCoverage(InputFile inputFile, SensorContext context) { File coverageFile = new File(inputFile.file().getParentFile(), inputFile.file().getName() + getCoverageExtension()); diff --git a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/extensions/XooPostJob.java b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/extensions/XooPostJob.java index a18816969a3..49d5f2d15df 100644 --- a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/extensions/XooPostJob.java +++ b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/extensions/XooPostJob.java @@ -22,12 +22,12 @@ package org.sonar.xoo.extensions; import org.sonar.api.batch.postjob.PostJob; import org.sonar.api.batch.postjob.PostJobContext; import org.sonar.api.batch.postjob.PostJobDescriptor; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class XooPostJob implements PostJob { - private static final Logger LOG = Loggers.get(XooPostJob.class); + private static final Logger LOG = LoggerFactory.getLogger(XooPostJob.class); @Override public void describe(PostJobDescriptor descriptor) { diff --git a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/global/DeprecatedGlobalSensor.java b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/global/DeprecatedGlobalSensor.java index fd5e82b60c7..1ae3b22b577 100644 --- a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/global/DeprecatedGlobalSensor.java +++ b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/global/DeprecatedGlobalSensor.java @@ -22,12 +22,12 @@ package org.sonar.xoo.global; import org.sonar.api.batch.sensor.Sensor; import org.sonar.api.batch.sensor.SensorContext; import org.sonar.api.batch.sensor.SensorDescriptor; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class DeprecatedGlobalSensor implements Sensor { - private static final Logger LOG = Loggers.get(DeprecatedGlobalSensor.class); + private static final Logger LOG = LoggerFactory.getLogger(DeprecatedGlobalSensor.class); public static final String ENABLE_PROP = "sonar.scanner.mediumtest.deprecatedGlobalSensor"; @Override diff --git a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/global/GlobalProjectSensor.java b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/global/GlobalProjectSensor.java index 2414666c193..0984e94b640 100644 --- a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/global/GlobalProjectSensor.java +++ b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/global/GlobalProjectSensor.java @@ -22,12 +22,12 @@ package org.sonar.xoo.global; import org.sonar.api.scanner.sensor.ProjectSensor; import org.sonar.api.batch.sensor.SensorContext; import org.sonar.api.batch.sensor.SensorDescriptor; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class GlobalProjectSensor implements ProjectSensor { - private static final Logger LOG = Loggers.get(GlobalProjectSensor.class); + private static final Logger LOG = LoggerFactory.getLogger(GlobalProjectSensor.class); public static final String ENABLE_PROP = "sonar.scanner.mediumtest.globalSensor"; @Override diff --git a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/lang/LineMeasureSensor.java b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/lang/LineMeasureSensor.java index 45c1bbeb742..5cb7c2de494 100644 --- a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/lang/LineMeasureSensor.java +++ b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/lang/LineMeasureSensor.java @@ -32,8 +32,8 @@ import org.sonar.api.batch.sensor.SensorDescriptor; import org.sonar.api.measures.FileLinesContext; import org.sonar.api.measures.FileLinesContextFactory; import org.sonar.api.utils.KeyValueFormat; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.xoo.Xoo; /** @@ -41,7 +41,7 @@ import org.sonar.xoo.Xoo; */ public class LineMeasureSensor implements Sensor { - private static final Logger LOG = Loggers.get(LineMeasureSensor.class); + private static final Logger LOG = LoggerFactory.getLogger(LineMeasureSensor.class); private static final String MEASURES_EXTENSION = ".linemeasures"; diff --git a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/lang/MeasureSensor.java b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/lang/MeasureSensor.java index 63b75424caa..cd4185b2240 100644 --- a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/lang/MeasureSensor.java +++ b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/lang/MeasureSensor.java @@ -33,8 +33,8 @@ import org.sonar.api.batch.sensor.Sensor; import org.sonar.api.batch.sensor.SensorContext; import org.sonar.api.batch.sensor.SensorDescriptor; import org.sonar.api.batch.sensor.measure.NewMeasure; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.xoo.Xoo; import org.sonar.xoo.Xoo2; @@ -43,7 +43,7 @@ import org.sonar.xoo.Xoo2; */ public class MeasureSensor implements Sensor { - private static final Logger LOG = Loggers.get(MeasureSensor.class); + private static final Logger LOG = LoggerFactory.getLogger(MeasureSensor.class); private static final String MEASURES_EXTENSION = ".measures"; diff --git a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/lang/SignificantCodeSensor.java b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/lang/SignificantCodeSensor.java index dc7cb46a36c..64166d1a6ab 100644 --- a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/lang/SignificantCodeSensor.java +++ b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/lang/SignificantCodeSensor.java @@ -29,12 +29,12 @@ import org.sonar.api.batch.sensor.Sensor; import org.sonar.api.batch.sensor.SensorContext; import org.sonar.api.batch.sensor.SensorDescriptor; import org.sonar.api.batch.sensor.code.NewSignificantCode; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.xoo.Xoo; public class SignificantCodeSensor implements Sensor { - private static final Logger LOG = Loggers.get(SignificantCodeSensor.class); + private static final Logger LOG = LoggerFactory.getLogger(SignificantCodeSensor.class); private static final String FILE_EXTENSION = ".significantCode"; @Override diff --git a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/lang/SymbolReferencesSensor.java b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/lang/SymbolReferencesSensor.java index 9dd8a659a05..0a5d4a111c9 100644 --- a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/lang/SymbolReferencesSensor.java +++ b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/lang/SymbolReferencesSensor.java @@ -32,8 +32,8 @@ import org.sonar.api.batch.sensor.SensorContext; import org.sonar.api.batch.sensor.SensorDescriptor; import org.sonar.api.batch.sensor.symbol.NewSymbol; import org.sonar.api.batch.sensor.symbol.NewSymbolTable; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.xoo.Xoo; import static java.lang.Integer.parseInt; @@ -43,7 +43,7 @@ import static java.lang.Integer.parseInt; */ public class SymbolReferencesSensor implements Sensor { - private static final Logger LOG = Loggers.get(SymbolReferencesSensor.class); + private static final Logger LOG = LoggerFactory.getLogger(SymbolReferencesSensor.class); private static final String SYMBOL_EXTENSION = ".symbol"; private void processFileSymbol(InputFile inputFile, SensorContext context) { diff --git a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/lang/SyntaxHighlightingSensor.java b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/lang/SyntaxHighlightingSensor.java index 75ee8488b31..6e10373d972 100644 --- a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/lang/SyntaxHighlightingSensor.java +++ b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/lang/SyntaxHighlightingSensor.java @@ -30,8 +30,8 @@ import org.sonar.api.batch.sensor.SensorContext; import org.sonar.api.batch.sensor.SensorDescriptor; import org.sonar.api.batch.sensor.highlighting.NewHighlighting; import org.sonar.api.batch.sensor.highlighting.TypeOfText; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.xoo.Xoo; import static java.lang.Integer.parseInt; @@ -41,7 +41,7 @@ import static java.lang.Integer.parseInt; */ public class SyntaxHighlightingSensor implements Sensor { - private static final Logger LOG = Loggers.get(SyntaxHighlightingSensor.class); + private static final Logger LOG = LoggerFactory.getLogger(SyntaxHighlightingSensor.class); private static final String HIGHLIGHTING_EXTENSION = ".highlighting"; private void processFileHighlighting(InputFile inputFile, SensorContext context) { diff --git a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/rule/AnalysisErrorSensor.java b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/rule/AnalysisErrorSensor.java index 22b17fb6215..2315c593e04 100644 --- a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/rule/AnalysisErrorSensor.java +++ b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/rule/AnalysisErrorSensor.java @@ -29,12 +29,12 @@ import org.sonar.api.batch.fs.InputFile; import org.sonar.api.batch.sensor.Sensor; import org.sonar.api.batch.sensor.SensorContext; import org.sonar.api.batch.sensor.SensorDescriptor; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.xoo.Xoo; public class AnalysisErrorSensor implements Sensor { - private static final Logger LOG = Loggers.get(AnalysisErrorSensor.class); + private static final Logger LOG = LoggerFactory.getLogger(AnalysisErrorSensor.class); private static final String ERROR_EXTENSION = ".error"; @Override diff --git a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/scm/XooIgnoreCommand.java b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/scm/XooIgnoreCommand.java index eab0a0116b9..002e4fc02ce 100644 --- a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/scm/XooIgnoreCommand.java +++ b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/scm/XooIgnoreCommand.java @@ -23,8 +23,8 @@ import java.io.File; import java.nio.file.Path; import org.apache.commons.io.FilenameUtils; import org.sonar.api.batch.scm.IgnoreCommand; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * To ignore a file simply add an empty file with the same name as the file to ignore with a .ignore suffix. @@ -33,7 +33,7 @@ import org.sonar.api.utils.log.Loggers; public class XooIgnoreCommand implements IgnoreCommand { static final String IGNORE_FILE_EXTENSION = ".ignore"; - private static final Logger LOG = Loggers.get(XooIgnoreCommand.class); + private static final Logger LOG = LoggerFactory.getLogger(XooIgnoreCommand.class); private boolean isInit; @Override diff --git a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/scm/XooScmProvider.java b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/scm/XooScmProvider.java index c70bbc367e1..a98462b21d1 100644 --- a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/scm/XooScmProvider.java +++ b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/scm/XooScmProvider.java @@ -19,6 +19,7 @@ */ package org.sonar.xoo.scm; +import java.io.File; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.nio.file.FileVisitResult; @@ -34,16 +35,14 @@ import java.util.Map; import java.util.Set; import javax.annotation.CheckForNull; import org.apache.commons.lang.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.api.batch.scm.BlameCommand; import org.sonar.api.batch.scm.IgnoreCommand; import org.sonar.api.batch.scm.ScmProvider; -import java.io.File; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; - public class XooScmProvider extends ScmProvider { - private static final Logger LOG = Loggers.get(XooScmProvider.class); + private static final Logger LOG = LoggerFactory.getLogger(XooScmProvider.class); private static final String SCM_EXTENSION = ".scm"; private final XooBlameCommand blame; diff --git a/server/sonar-alm-client/src/main/java/org/sonar/alm/client/TimeoutConfigurationImpl.java b/server/sonar-alm-client/src/main/java/org/sonar/alm/client/TimeoutConfigurationImpl.java index 058a8db87a5..1b4f72cc4ab 100644 --- a/server/sonar-alm-client/src/main/java/org/sonar/alm/client/TimeoutConfigurationImpl.java +++ b/server/sonar-alm-client/src/main/java/org/sonar/alm/client/TimeoutConfigurationImpl.java @@ -22,7 +22,7 @@ package org.sonar.alm.client; import com.google.common.annotations.VisibleForTesting; import java.util.OptionalLong; import org.sonar.api.config.Configuration; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.LoggerFactory; /** * Implementation of {@link TimeoutConfiguration} reading values from configuration properties. @@ -52,7 +52,7 @@ public class TimeoutConfigurationImpl implements TimeoutConfiguration { try { return OptionalLong.of(Long.parseLong(value)); } catch (NumberFormatException e) { - Loggers.get(TimeoutConfigurationImpl.class) + LoggerFactory.getLogger(TimeoutConfigurationImpl.class) .warn("Value of property {} can not be parsed to a long: {}", property, value); return OptionalLong.empty(); } diff --git a/server/sonar-alm-client/src/main/java/org/sonar/alm/client/azure/AzureDevOpsHttpClient.java b/server/sonar-alm-client/src/main/java/org/sonar/alm/client/azure/AzureDevOpsHttpClient.java index 7df02e3aa58..cf4d3a2bdbd 100644 --- a/server/sonar-alm-client/src/main/java/org/sonar/alm/client/azure/AzureDevOpsHttpClient.java +++ b/server/sonar-alm-client/src/main/java/org/sonar/alm/client/azure/AzureDevOpsHttpClient.java @@ -38,8 +38,8 @@ import org.apache.commons.codec.binary.Base64; import org.apache.commons.lang.StringUtils; import org.sonar.alm.client.TimeoutConfiguration; import org.sonar.api.server.ServerSide; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonarqube.ws.client.OkHttpClientBuilder; import static java.util.stream.Collectors.joining; @@ -49,7 +49,7 @@ import static org.sonar.api.internal.apachecommons.lang.StringUtils.substringBef @ServerSide public class AzureDevOpsHttpClient { - private static final Logger LOG = Loggers.get(AzureDevOpsHttpClient.class); + private static final Logger LOG = LoggerFactory.getLogger(AzureDevOpsHttpClient.class); public static final String API_VERSION_3 = "api-version=3.0"; diff --git a/server/sonar-alm-client/src/main/java/org/sonar/alm/client/bitbucket/bitbucketcloud/BitbucketCloudRestClient.java b/server/sonar-alm-client/src/main/java/org/sonar/alm/client/bitbucket/bitbucketcloud/BitbucketCloudRestClient.java index e7c82d0a818..d550b30d280 100644 --- a/server/sonar-alm-client/src/main/java/org/sonar/alm/client/bitbucket/bitbucketcloud/BitbucketCloudRestClient.java +++ b/server/sonar-alm-client/src/main/java/org/sonar/alm/client/bitbucket/bitbucketcloud/BitbucketCloudRestClient.java @@ -38,15 +38,15 @@ import okhttp3.RequestBody; import okhttp3.Response; import okhttp3.ResponseBody; import org.sonar.api.server.ServerSide; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.server.exceptions.NotFoundException; import static org.sonar.api.internal.apachecommons.lang.StringUtils.removeEnd; @ServerSide public class BitbucketCloudRestClient { - private static final Logger LOG = Loggers.get(BitbucketCloudRestClient.class); + private static final Logger LOG = LoggerFactory.getLogger(BitbucketCloudRestClient.class); private static final String AUTHORIZATION = "Authorization"; private static final String GET = "GET"; private static final String ENDPOINT = "https://api.bitbucket.org"; diff --git a/server/sonar-alm-client/src/main/java/org/sonar/alm/client/bitbucketserver/BitbucketServerRestClient.java b/server/sonar-alm-client/src/main/java/org/sonar/alm/client/bitbucketserver/BitbucketServerRestClient.java index 461719f6ee0..36bf981eb22 100644 --- a/server/sonar-alm-client/src/main/java/org/sonar/alm/client/bitbucketserver/BitbucketServerRestClient.java +++ b/server/sonar-alm-client/src/main/java/org/sonar/alm/client/bitbucketserver/BitbucketServerRestClient.java @@ -38,8 +38,8 @@ import okhttp3.RequestBody; import okhttp3.Response; import org.sonar.alm.client.TimeoutConfiguration; import org.sonar.api.server.ServerSide; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonarqube.ws.client.OkHttpClientBuilder; import static com.google.common.base.Strings.isNullOrEmpty; @@ -52,7 +52,7 @@ import static org.sonar.api.internal.apachecommons.lang.StringUtils.removeEnd; @ServerSide public class BitbucketServerRestClient { - private static final Logger LOG = Loggers.get(BitbucketServerRestClient.class); + private static final Logger LOG = LoggerFactory.getLogger(BitbucketServerRestClient.class); private static final String GET = "GET"; protected static final String UNABLE_TO_CONTACT_BITBUCKET_SERVER = "Unable to contact Bitbucket server"; diff --git a/server/sonar-alm-client/src/main/java/org/sonar/alm/client/github/GithubApplicationClientImpl.java b/server/sonar-alm-client/src/main/java/org/sonar/alm/client/github/GithubApplicationClientImpl.java index 4b771efee8e..c1f9e28a8c8 100644 --- a/server/sonar-alm-client/src/main/java/org/sonar/alm/client/github/GithubApplicationClientImpl.java +++ b/server/sonar-alm-client/src/main/java/org/sonar/alm/client/github/GithubApplicationClientImpl.java @@ -44,8 +44,8 @@ import org.sonar.alm.client.github.security.GithubAppSecurity; import org.sonar.alm.client.github.security.UserAccessToken; import org.sonar.alm.client.gitlab.GsonApp; import org.sonar.api.internal.apachecommons.lang.StringUtils; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.auth.github.GitHubSettings; import org.sonar.server.exceptions.ServerException; import org.sonarqube.ws.client.HttpException; @@ -58,7 +58,7 @@ import static java.net.HttpURLConnection.HTTP_OK; import static java.net.HttpURLConnection.HTTP_UNAUTHORIZED; public class GithubApplicationClientImpl implements GithubApplicationClient { - private static final Logger LOG = Loggers.get(GithubApplicationClientImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(GithubApplicationClientImpl.class); protected static final Gson GSON = new Gson(); protected static final String WRITE_PERMISSION_NAME = "write"; diff --git a/server/sonar-alm-client/src/main/java/org/sonar/alm/client/github/GithubApplicationHttpClientImpl.java b/server/sonar-alm-client/src/main/java/org/sonar/alm/client/github/GithubApplicationHttpClientImpl.java index e908f7425aa..177f8995f6b 100644 --- a/server/sonar-alm-client/src/main/java/org/sonar/alm/client/github/GithubApplicationHttpClientImpl.java +++ b/server/sonar-alm-client/src/main/java/org/sonar/alm/client/github/GithubApplicationHttpClientImpl.java @@ -36,8 +36,8 @@ import okhttp3.ResponseBody; import org.apache.commons.lang.StringUtils; import org.sonar.alm.client.TimeoutConfiguration; import org.sonar.alm.client.github.security.AccessToken; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonarqube.ws.client.OkHttpClientBuilder; import static com.google.common.base.Preconditions.checkArgument; @@ -51,7 +51,7 @@ import static java.util.Optional.ofNullable; public class GithubApplicationHttpClientImpl implements GithubApplicationHttpClient { - private static final Logger LOG = Loggers.get(GithubApplicationHttpClientImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(GithubApplicationHttpClientImpl.class); private static final Pattern NEXT_LINK_PATTERN = Pattern.compile("<([^<]+)>; rel=\"next\""); private static final String GH_API_VERSION_HEADER = "X-GitHub-Api-Version"; private static final String GH_API_VERSION = "2022-11-28"; diff --git a/server/sonar-alm-client/src/main/java/org/sonar/alm/client/gitlab/GitlabHttpClient.java b/server/sonar-alm-client/src/main/java/org/sonar/alm/client/gitlab/GitlabHttpClient.java index ac8bff1b5b0..ab1f4b5fb69 100644 --- a/server/sonar-alm-client/src/main/java/org/sonar/alm/client/gitlab/GitlabHttpClient.java +++ b/server/sonar-alm-client/src/main/java/org/sonar/alm/client/gitlab/GitlabHttpClient.java @@ -37,8 +37,8 @@ import okhttp3.Response; import org.apache.logging.log4j.util.Strings; import org.sonar.alm.client.TimeoutConfiguration; import org.sonar.api.server.ServerSide; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonarqube.ws.MediaTypes; import org.sonarqube.ws.client.OkHttpClientBuilder; @@ -49,7 +49,7 @@ import static java.nio.charset.StandardCharsets.UTF_8; @ServerSide public class GitlabHttpClient { - private static final Logger LOG = Loggers.get(GitlabHttpClient.class); + private static final Logger LOG = LoggerFactory.getLogger(GitlabHttpClient.class); protected static final String PRIVATE_TOKEN = "Private-Token"; protected final OkHttpClient client; diff --git a/server/sonar-auth-bitbucket/src/main/java/org/sonar/auth/bitbucket/BitbucketIdentityProvider.java b/server/sonar-auth-bitbucket/src/main/java/org/sonar/auth/bitbucket/BitbucketIdentityProvider.java index 58dd889d670..c540c5ead33 100755 --- a/server/sonar-auth-bitbucket/src/main/java/org/sonar/auth/bitbucket/BitbucketIdentityProvider.java +++ b/server/sonar-auth-bitbucket/src/main/java/org/sonar/auth/bitbucket/BitbucketIdentityProvider.java @@ -39,8 +39,8 @@ import org.sonar.api.server.authentication.OAuth2IdentityProvider; import org.sonar.api.server.authentication.UnauthorizedException; import org.sonar.api.server.authentication.UserIdentity; import org.sonar.api.server.http.HttpRequest; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import static com.google.common.base.Preconditions.checkState; import static java.lang.String.format; @@ -50,7 +50,7 @@ import static java.util.stream.Collectors.toSet; @ServerSide public class BitbucketIdentityProvider implements OAuth2IdentityProvider { - private static final Logger LOGGER = Loggers.get(BitbucketIdentityProvider.class); + private static final Logger LOGGER = LoggerFactory.getLogger(BitbucketIdentityProvider.class); public static final String REQUIRED_SCOPE = "account"; public static final String KEY = "bitbucket"; diff --git a/server/sonar-auth-github/src/main/java/org/sonar/auth/github/GitHubRestClient.java b/server/sonar-auth-github/src/main/java/org/sonar/auth/github/GitHubRestClient.java index 580fc46565f..531a4a71e5b 100644 --- a/server/sonar-auth-github/src/main/java/org/sonar/auth/github/GitHubRestClient.java +++ b/server/sonar-auth-github/src/main/java/org/sonar/auth/github/GitHubRestClient.java @@ -28,8 +28,8 @@ import java.io.IOException; import java.net.HttpURLConnection; import java.util.List; import java.util.concurrent.ExecutionException; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import static java.lang.String.format; import static org.sonar.auth.OAuthRestClient.executePaginatedRequest; @@ -37,7 +37,7 @@ import static org.sonar.auth.OAuthRestClient.executeRequest; public class GitHubRestClient { - private static final Logger LOGGER = Loggers.get(GitHubRestClient.class); + private static final Logger LOGGER = LoggerFactory.getLogger(GitHubRestClient.class); private final GitHubSettings settings; diff --git a/server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/ContextHelper.java b/server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/ContextHelper.java index 97cd7801f40..8af6640be95 100644 --- a/server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/ContextHelper.java +++ b/server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/ContextHelper.java @@ -22,15 +22,15 @@ package org.sonar.auth.ldap; import javax.annotation.Nullable; import javax.naming.Context; import javax.naming.NamingException; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * @author Evgeny Mandrikov */ public final class ContextHelper { - private static final Logger LOG = Loggers.get(ContextHelper.class); + private static final Logger LOG = LoggerFactory.getLogger(ContextHelper.class); private ContextHelper() { } diff --git a/server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/DefaultLdapAuthenticator.java b/server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/DefaultLdapAuthenticator.java index ecd50b8b77b..8eee618d905 100644 --- a/server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/DefaultLdapAuthenticator.java +++ b/server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/DefaultLdapAuthenticator.java @@ -28,8 +28,8 @@ import javax.security.auth.login.LoginContext; import javax.security.auth.login.LoginException; import org.apache.commons.lang.StringUtils; import org.sonar.api.server.ServerSide; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * @author Evgeny Mandrikov @@ -37,7 +37,7 @@ import org.sonar.api.utils.log.Loggers; @ServerSide public class DefaultLdapAuthenticator implements LdapAuthenticator { - private static final Logger LOG = Loggers.get(DefaultLdapAuthenticator.class); + private static final Logger LOG = LoggerFactory.getLogger(DefaultLdapAuthenticator.class); private final Map<String, LdapContextFactory> contextFactories; private final Map<String, LdapUserMapping> userMappings; diff --git a/server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/DefaultLdapGroupsProvider.java b/server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/DefaultLdapGroupsProvider.java index 6f7515c1138..45eab7bdc6f 100644 --- a/server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/DefaultLdapGroupsProvider.java +++ b/server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/DefaultLdapGroupsProvider.java @@ -28,8 +28,8 @@ import javax.naming.NamingException; import javax.naming.directory.Attributes; import javax.naming.directory.SearchResult; import org.sonar.api.server.ServerSide; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import static java.lang.String.format; @@ -39,7 +39,7 @@ import static java.lang.String.format; @ServerSide public class DefaultLdapGroupsProvider implements LdapGroupsProvider { - private static final Logger LOG = Loggers.get(DefaultLdapGroupsProvider.class); + private static final Logger LOG = LoggerFactory.getLogger(DefaultLdapGroupsProvider.class); private final Map<String, LdapContextFactory> contextFactories; private final Map<String, LdapUserMapping> userMappings; diff --git a/server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/DefaultLdapUsersProvider.java b/server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/DefaultLdapUsersProvider.java index d9af9e48357..d1ba55fcae7 100644 --- a/server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/DefaultLdapUsersProvider.java +++ b/server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/DefaultLdapUsersProvider.java @@ -26,8 +26,8 @@ import javax.naming.directory.Attribute; import javax.naming.directory.Attributes; import javax.naming.directory.SearchResult; import org.sonar.api.server.ServerSide; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import static java.lang.String.format; @@ -37,7 +37,7 @@ import static java.lang.String.format; @ServerSide public class DefaultLdapUsersProvider implements LdapUsersProvider { - private static final Logger LOG = Loggers.get(DefaultLdapUsersProvider.class); + private static final Logger LOG = LoggerFactory.getLogger(DefaultLdapUsersProvider.class); private final Map<String, LdapContextFactory> contextFactories; private final Map<String, LdapUserMapping> userMappings; diff --git a/server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/LdapContextFactory.java b/server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/LdapContextFactory.java index 58bab323d16..abe882e62c1 100644 --- a/server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/LdapContextFactory.java +++ b/server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/LdapContextFactory.java @@ -35,15 +35,15 @@ import javax.security.auth.login.Configuration; import javax.security.auth.login.LoginContext; import javax.security.auth.login.LoginException; import org.apache.commons.lang.StringUtils; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * @author Evgeny Mandrikov */ public class LdapContextFactory { - private static final Logger LOG = Loggers.get(LdapContextFactory.class); + private static final Logger LOG = LoggerFactory.getLogger(LdapContextFactory.class); // visible for testing static final String AUTH_METHOD_SIMPLE = "simple"; diff --git a/server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/LdapRealm.java b/server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/LdapRealm.java index b39e54bb412..f647a839fe3 100644 --- a/server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/LdapRealm.java +++ b/server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/LdapRealm.java @@ -23,8 +23,8 @@ import java.util.Map; import javax.annotation.CheckForNull; import org.sonar.api.config.Configuration; import org.sonar.api.server.ServerSide; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import static org.sonar.auth.ldap.LdapSettingsManager.DEFAULT_LDAP_SERVER_KEY; import static org.sonar.process.ProcessProperties.Property.SONAR_AUTHENTICATOR_IGNORE_STARTUP_FAILURE; @@ -38,7 +38,7 @@ public class LdapRealm { public static final String LDAP_SECURITY_REALM = "LDAP"; public static final String DEFAULT_LDAP_IDENTITY_PROVIDER_ID = LDAP_SECURITY_REALM + "_" + DEFAULT_LDAP_SERVER_KEY; - private static final Logger LOG = Loggers.get(LdapRealm.class); + private static final Logger LOG = LoggerFactory.getLogger(LdapRealm.class); private final boolean isLdapAuthActivated; private final LdapUsersProvider usersProvider; diff --git a/server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/LdapSearch.java b/server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/LdapSearch.java index 2ab29240d68..f29121d3ccf 100644 --- a/server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/LdapSearch.java +++ b/server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/LdapSearch.java @@ -26,8 +26,8 @@ import javax.naming.PartialResultException; import javax.naming.directory.InitialDirContext; import javax.naming.directory.SearchControls; import javax.naming.directory.SearchResult; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Fluent API for building LDAP queries. @@ -36,7 +36,7 @@ import org.sonar.api.utils.log.Loggers; */ public class LdapSearch { - private static final Logger LOG = Loggers.get(LdapSearch.class); + private static final Logger LOG = LoggerFactory.getLogger(LdapSearch.class); private final LdapContextFactory contextFactory; diff --git a/server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/LdapSettingsManager.java b/server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/LdapSettingsManager.java index 4d57a61728b..98d91adc131 100644 --- a/server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/LdapSettingsManager.java +++ b/server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/LdapSettingsManager.java @@ -24,8 +24,8 @@ import java.util.Map; import org.apache.commons.lang.StringUtils; import org.sonar.api.config.Configuration; import org.sonar.api.server.ServerSide; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * The LdapSettingsManager will parse the settings. @@ -35,7 +35,7 @@ import org.sonar.api.utils.log.Loggers; public class LdapSettingsManager { public static final String DEFAULT_LDAP_SERVER_KEY = "default"; - private static final Logger LOG = Loggers.get(LdapSettingsManager.class); + private static final Logger LOG = LoggerFactory.getLogger(LdapSettingsManager.class); private static final String LDAP_SERVERS_PROPERTY = "ldap.servers"; private static final String LDAP_PROPERTY_PREFIX = "ldap"; diff --git a/server/sonar-auth-saml/src/main/java/org/sonar/auth/saml/SamlAuthenticator.java b/server/sonar-auth-saml/src/main/java/org/sonar/auth/saml/SamlAuthenticator.java index 13d2200bc71..d9f29b3b9b1 100644 --- a/server/sonar-auth-saml/src/main/java/org/sonar/auth/saml/SamlAuthenticator.java +++ b/server/sonar-auth-saml/src/main/java/org/sonar/auth/saml/SamlAuthenticator.java @@ -40,8 +40,8 @@ import org.sonar.api.server.authentication.UnauthorizedException; import org.sonar.api.server.authentication.UserIdentity; import org.sonar.api.server.http.HttpRequest; import org.sonar.api.server.http.HttpResponse; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.server.http.JavaxHttpRequest; import org.sonar.server.http.JavaxHttpResponse; @@ -53,7 +53,7 @@ import static org.sonar.auth.saml.SamlStatusChecker.getSamlAuthenticationStatus; public class SamlAuthenticator { - private static final Logger LOGGER = Loggers.get(SamlAuthenticator.class); + private static final Logger LOGGER = LoggerFactory.getLogger(SamlAuthenticator.class); private static final String ANY_URL = "http://anyurl"; private static final String STATE_REQUEST_PARAMETER = "RelayState"; diff --git a/server/sonar-ce-common/src/main/java/org/sonar/ce/queue/CeQueueImpl.java b/server/sonar-ce-common/src/main/java/org/sonar/ce/queue/CeQueueImpl.java index e0af41a2682..88b77baec5c 100644 --- a/server/sonar-ce-common/src/main/java/org/sonar/ce/queue/CeQueueImpl.java +++ b/server/sonar-ce-common/src/main/java/org/sonar/ce/queue/CeQueueImpl.java @@ -37,7 +37,7 @@ import javax.annotation.CheckForNull; import javax.annotation.Nullable; import org.sonar.api.server.ServerSide; import org.sonar.api.utils.System2; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.LoggerFactory; import org.sonar.ce.task.CeTask; import org.sonar.core.util.UuidFactory; import org.sonar.core.util.stream.MoreCollectors; @@ -305,7 +305,7 @@ public class CeQueueImpl implements CeQueue { if (deletedTasks == 1) { dbSession.commit(); } else { - Loggers.get(CeQueueImpl.class).debug( + LoggerFactory.getLogger(CeQueueImpl.class).debug( "Remove rolled back because task in queue with uuid {} and status {} could not be deleted", taskUuid, expectedQueueDtoStatus); dbSession.rollback(); diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/api/posttask/PostProjectAnalysisTasksExecutor.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/api/posttask/PostProjectAnalysisTasksExecutor.java index 264ce829f11..1bee87571ad 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/api/posttask/PostProjectAnalysisTasksExecutor.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/api/posttask/PostProjectAnalysisTasksExecutor.java @@ -34,8 +34,8 @@ import org.sonar.api.ce.posttask.PostProjectAnalysisTask; import org.sonar.api.ce.posttask.Project; import org.sonar.api.ce.posttask.QualityGate; import org.sonar.api.ce.posttask.ScannerContext; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.ce.task.projectanalysis.analysis.AnalysisMetadataHolder; import org.sonar.ce.task.projectanalysis.batch.BatchReportReader; import org.sonar.ce.task.projectanalysis.qualitygate.Condition; @@ -63,7 +63,7 @@ import static org.sonar.db.component.BranchType.PULL_REQUEST; public class PostProjectAnalysisTasksExecutor implements ComputationStepExecutor.Listener { private static final PostProjectAnalysisTask[] NO_POST_PROJECT_ANALYSIS_TASKS = new PostProjectAnalysisTask[0]; - private static final Logger LOG = Loggers.get(PostProjectAnalysisTasksExecutor.class); + private static final Logger LOG = LoggerFactory.getLogger(PostProjectAnalysisTasksExecutor.class); private final org.sonar.ce.task.CeTask ceTask; private final AnalysisMetadataHolder analysisMetadataHolder; diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/component/VisitorsCrawler.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/component/VisitorsCrawler.java index 0dcb3d70618..338ec12eba2 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/component/VisitorsCrawler.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/component/VisitorsCrawler.java @@ -28,7 +28,7 @@ import java.util.function.Function; import java.util.function.Predicate; import java.util.stream.Collectors; import javax.annotation.Nonnull; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.LoggerFactory; import org.sonar.core.util.logs.Profiler; import static com.google.common.collect.Iterables.concat; @@ -109,7 +109,7 @@ public class VisitorsCrawler implements ComponentCrawler { } private void visitNode(Component component, VisitorWrapper visitor) { - Profiler profiler = Profiler.create(Loggers.get(visitor.getWrappedVisitor().getClass())) + Profiler profiler = Profiler.create(LoggerFactory.getLogger(visitor.getWrappedVisitor().getClass())) .startTrace("Visiting component {}", component.getKey()); visitor.visitAny(component); switch (component.getType()) { diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/duplication/CrossProjectDuplicationStatusHolderImpl.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/duplication/CrossProjectDuplicationStatusHolderImpl.java index 326da9a5f7d..726ed2aa49f 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/duplication/CrossProjectDuplicationStatusHolderImpl.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/duplication/CrossProjectDuplicationStatusHolderImpl.java @@ -21,15 +21,15 @@ package org.sonar.ce.task.projectanalysis.duplication; import javax.annotation.CheckForNull; import org.sonar.api.Startable; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.ce.task.projectanalysis.analysis.AnalysisMetadataHolder; import static com.google.common.base.Preconditions.checkState; public class CrossProjectDuplicationStatusHolderImpl implements CrossProjectDuplicationStatusHolder, Startable { - private static final Logger LOGGER = Loggers.get(CrossProjectDuplicationStatusHolderImpl.class); + private static final Logger LOGGER = LoggerFactory.getLogger(CrossProjectDuplicationStatusHolderImpl.class); @CheckForNull private Boolean enabled; diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/duplication/IntegrateCrossProjectDuplications.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/duplication/IntegrateCrossProjectDuplications.java index e9b902642ea..ea91f519a05 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/duplication/IntegrateCrossProjectDuplications.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/duplication/IntegrateCrossProjectDuplications.java @@ -28,8 +28,8 @@ import java.util.function.Predicate; import javax.annotation.Nonnull; import org.sonar.api.config.Configuration; import org.sonar.api.utils.System2; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.ce.task.log.CeTaskMessages; import org.sonar.ce.task.projectanalysis.component.Component; import org.sonar.duplications.block.Block; @@ -44,7 +44,7 @@ import org.sonar.duplications.index.PackedMemoryCloneIndex; */ public class IntegrateCrossProjectDuplications { - private static final Logger LOGGER = Loggers.get(IntegrateCrossProjectDuplications.class); + private static final Logger LOGGER = LoggerFactory.getLogger(IntegrateCrossProjectDuplications.class); private static final String JAVA_KEY = "java"; private static final String DEPRECATED_WARNING = "This analysis uses the deprecated cross-project duplication feature."; private static final String DEPRECATED_WARNING_DASHBOARD = "This project uses the deprecated cross-project duplication feature."; diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/filemove/FileMoveDetectionStep.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/filemove/FileMoveDetectionStep.java index 1013fe56de4..9e545bfba94 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/filemove/FileMoveDetectionStep.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/filemove/FileMoveDetectionStep.java @@ -38,8 +38,8 @@ import java.util.stream.Collectors; import javax.annotation.Nullable; import org.apache.ibatis.session.ResultContext; import org.apache.ibatis.session.ResultHandler; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.ce.task.projectanalysis.analysis.AnalysisMetadataHolder; import org.sonar.ce.task.projectanalysis.component.Component; import org.sonar.ce.task.projectanalysis.component.CrawlerDepthLimit; @@ -62,7 +62,7 @@ import static org.sonar.ce.task.projectanalysis.component.ComponentVisitor.Order public class FileMoveDetectionStep implements ComputationStep { static final int MIN_REQUIRED_SCORE = 85; - private static final Logger LOG = Loggers.get(FileMoveDetectionStep.class); + private static final Logger LOG = LoggerFactory.getLogger(FileMoveDetectionStep.class); private static final Comparator<ScoreMatrix.ScoreFile> SCORE_FILE_COMPARATOR = (o1, o2) -> -1 * Integer.compare(o1.getLineCount(), o2.getLineCount()); private static final double LOWER_BOUND_RATIO = 0.84; private static final double UPPER_BOUND_RATIO = 1.18; diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/filemove/PullRequestFileMoveDetectionStep.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/filemove/PullRequestFileMoveDetectionStep.java index 978f76983f3..474b50436c4 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/filemove/PullRequestFileMoveDetectionStep.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/filemove/PullRequestFileMoveDetectionStep.java @@ -26,8 +26,8 @@ import java.util.Map; import java.util.Objects; import java.util.Optional; import org.apache.ibatis.session.ResultHandler; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.ce.task.projectanalysis.analysis.AnalysisMetadataHolder; import org.sonar.ce.task.projectanalysis.component.Component; import org.sonar.ce.task.projectanalysis.component.CrawlerDepthLimit; @@ -47,7 +47,7 @@ import static java.util.stream.Collectors.toMap; import static org.sonar.ce.task.projectanalysis.component.ComponentVisitor.Order.POST_ORDER; public class PullRequestFileMoveDetectionStep implements ComputationStep { - private static final Logger LOG = Loggers.get(PullRequestFileMoveDetectionStep.class); + private static final Logger LOG = LoggerFactory.getLogger(PullRequestFileMoveDetectionStep.class); private final AnalysisMetadataHolder analysisMetadataHolder; private final TreeRootHolder rootHolder; diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/filemove/ScoreMatrixDumperImpl.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/filemove/ScoreMatrixDumperImpl.java index 605f9b42cf5..7f588eaa0aa 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/filemove/ScoreMatrixDumperImpl.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/filemove/ScoreMatrixDumperImpl.java @@ -24,15 +24,15 @@ import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import org.sonar.api.config.Configuration; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.ce.task.CeTask; import org.sonar.server.platform.ServerFileSystem; import static java.nio.charset.StandardCharsets.UTF_8; public class ScoreMatrixDumperImpl implements ScoreMatrixDumper { - private static final Logger LOG = Loggers.get(ScoreMatrixDumperImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(ScoreMatrixDumperImpl.class); private final Configuration configuration; private final CeTask ceTask; diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/ComponentIssuesLoader.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/ComponentIssuesLoader.java index 9b793370cbd..0406506f8a7 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/ComponentIssuesLoader.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/ComponentIssuesLoader.java @@ -33,7 +33,7 @@ import org.sonar.api.config.Configuration; import org.sonar.api.rule.RuleKey; import org.sonar.api.rule.RuleStatus; import org.sonar.api.utils.System2; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.LoggerFactory; import org.sonar.ce.task.projectanalysis.qualityprofile.ActiveRulesHolder; import org.sonar.core.issue.DefaultIssue; import org.sonar.core.issue.FieldDiffs; @@ -146,7 +146,7 @@ public class ComponentIssuesLoader { try { return Integer.parseInt(str); } catch (NumberFormatException e) { - Loggers.get(ComponentIssuesLoader.class) + LoggerFactory.getLogger(ComponentIssuesLoader.class) .warn("Value of property {} should be an integer >= 0: {}", PROPERTY_CLOSED_ISSUE_MAX_AGE, str); return null; } diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/TrackerRawInputFactory.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/TrackerRawInputFactory.java index 27ca7fbbf2f..7996cafb8c0 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/TrackerRawInputFactory.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/TrackerRawInputFactory.java @@ -30,7 +30,7 @@ import org.jetbrains.annotations.NotNull; import org.sonar.api.rule.RuleKey; import org.sonar.api.rules.RuleType; import org.sonar.api.utils.Duration; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.LoggerFactory; import org.sonar.ce.task.projectanalysis.batch.BatchReportReader; import org.sonar.ce.task.projectanalysis.component.Component; import org.sonar.ce.task.projectanalysis.component.TreeRootHolder; @@ -109,7 +109,7 @@ public class TrackerRawInputFactory { continue; } if (!isIssueOnUnsupportedCommonRule(reportIssue)) { - Loggers.get(getClass()).debug("Ignored issue from analysis report on rule {}:{}", reportIssue.getRuleRepository(), reportIssue.getRuleKey()); + LoggerFactory.getLogger(getClass()).debug("Ignored issue from analysis report on rule {}:{}", reportIssue.getRuleRepository(), reportIssue.getRuleKey()); continue; } DefaultIssue issue = toIssue(getLineHashSequence(), reportIssue); diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/UpdateConflictResolver.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/UpdateConflictResolver.java index 55238e92ddc..2d3dc830a46 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/UpdateConflictResolver.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/UpdateConflictResolver.java @@ -20,8 +20,8 @@ package org.sonar.ce.task.projectanalysis.issue; import com.google.common.annotations.VisibleForTesting; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.core.issue.DefaultIssue; import org.sonar.db.issue.IssueDto; import org.sonar.db.issue.IssueMapper; @@ -32,7 +32,7 @@ import org.sonar.db.issue.IssueMapper; */ public class UpdateConflictResolver { - private static final Logger LOG = Loggers.get(UpdateConflictResolver.class); + private static final Logger LOG = LoggerFactory.getLogger(UpdateConflictResolver.class); public void resolve(DefaultIssue issue, IssueDto dbIssue, IssueMapper mapper) { LOG.debug("Resolve conflict on issue {}", issue.key()); diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/filter/IssueFilter.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/filter/IssueFilter.java index 906a55c23bb..1fd1dd8bec2 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/filter/IssueFilter.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/filter/IssueFilter.java @@ -25,8 +25,8 @@ import java.util.Iterator; import java.util.List; import org.sonar.api.ce.ComputeEngineSide; import org.sonar.api.config.Configuration; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.ce.task.projectanalysis.component.Component; import org.sonar.ce.task.projectanalysis.component.ConfigurationRepository; import org.sonar.core.issue.DefaultIssue; @@ -43,7 +43,7 @@ import static org.sonar.core.config.IssueExclusionProperties.RULE_KEY; @ComputeEngineSide public class IssueFilter { - private static final Logger LOG = Loggers.get(IssueFilter.class); + private static final Logger LOG = LoggerFactory.getLogger(IssueFilter.class); private final List<IssuePattern> exclusionPatterns; private final List<IssuePattern> inclusionPatterns; diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/MeasureComputersVisitor.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/MeasureComputersVisitor.java index 9f06b19d790..5e298abb673 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/MeasureComputersVisitor.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/MeasureComputersVisitor.java @@ -20,8 +20,8 @@ package org.sonar.ce.task.projectanalysis.measure; import org.sonar.api.ce.measure.MeasureComputer; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.ce.task.projectanalysis.api.measurecomputer.MeasureComputerContextImpl; import org.sonar.ce.task.projectanalysis.api.measurecomputer.MeasureComputerWrapper; import org.sonar.ce.task.projectanalysis.component.ConfigurationRepository; @@ -36,7 +36,7 @@ import static org.sonar.ce.task.projectanalysis.component.ComponentVisitor.Order public class MeasureComputersVisitor extends TypeAwareVisitorAdapter { - private static final Logger LOGGER = Loggers.get(MeasureComputersVisitor.class); + private static final Logger LOGGER = LoggerFactory.getLogger(MeasureComputersVisitor.class); private final MetricRepository metricRepository; private final MeasureRepository measureRepository; diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/metric/ReportMetricValidatorImpl.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/metric/ReportMetricValidatorImpl.java index a96a700c19c..93ec34fccff 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/metric/ReportMetricValidatorImpl.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/metric/ReportMetricValidatorImpl.java @@ -23,13 +23,13 @@ import java.util.HashSet; import java.util.Map; import java.util.Set; import org.sonar.api.measures.Metric; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.core.metric.ScannerMetrics; import org.sonar.core.util.stream.MoreCollectors; public class ReportMetricValidatorImpl implements ReportMetricValidator { - private static final Logger LOG = Loggers.get(ReportMetricValidatorImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(ReportMetricValidatorImpl.class); private final Map<String, Metric> metricByKey; private final Set<String> alreadyLoggedMetricKeys = new HashSet<>(); diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/period/NewCodePeriodResolver.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/period/NewCodePeriodResolver.java index 44d76956c70..c3480c7e872 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/period/NewCodePeriodResolver.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/period/NewCodePeriodResolver.java @@ -29,8 +29,8 @@ import javax.annotation.CheckForNull; import javax.annotation.Nullable; import org.sonar.api.utils.DateUtils; import org.sonar.api.utils.MessageException; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.ce.task.projectanalysis.analysis.AnalysisMetadataHolder; import org.sonar.db.DbClient; import org.sonar.db.DbSession; @@ -49,7 +49,7 @@ import static org.sonar.db.component.SnapshotQuery.SORT_FIELD.BY_DATE; import static org.sonar.db.component.SnapshotQuery.SORT_ORDER.ASC; public class NewCodePeriodResolver { - private static final Logger LOG = Loggers.get(NewCodePeriodResolver.class); + private static final Logger LOG = LoggerFactory.getLogger(NewCodePeriodResolver.class); private final DbClient dbClient; private final AnalysisMetadataHolder analysisMetadataHolder; diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/purge/ProjectCleaner.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/purge/ProjectCleaner.java index a5d1d885745..77f389ff654 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/purge/ProjectCleaner.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/purge/ProjectCleaner.java @@ -25,8 +25,8 @@ import org.sonar.api.ce.ComputeEngineSide; import org.sonar.api.config.Configuration; import org.sonar.api.server.ServerSide; import org.sonar.api.utils.TimeUtils; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.db.DbSession; import org.sonar.db.purge.PurgeConfiguration; import org.sonar.db.purge.PurgeDao; @@ -39,7 +39,7 @@ import static org.sonar.db.purge.PurgeConfiguration.newDefaultPurgeConfiguration @ServerSide @ComputeEngineSide public class ProjectCleaner { - private static final Logger LOG = Loggers.get(ProjectCleaner.class); + private static final Logger LOG = LoggerFactory.getLogger(ProjectCleaner.class); private final PurgeProfiler profiler; private final PurgeListener purgeListener; diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/qualitymodel/NewMaintainabilityMeasuresVisitor.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/qualitymodel/NewMaintainabilityMeasuresVisitor.java index 299ecb6f7b4..f7e147999c2 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/qualitymodel/NewMaintainabilityMeasuresVisitor.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/qualitymodel/NewMaintainabilityMeasuresVisitor.java @@ -24,8 +24,8 @@ import java.util.Optional; import java.util.Set; import org.sonar.api.measures.CoreMetrics; import org.sonar.api.utils.KeyValueFormat; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.ce.task.projectanalysis.component.Component; import org.sonar.ce.task.projectanalysis.component.CrawlerDepthLimit; import org.sonar.ce.task.projectanalysis.component.PathAwareVisitorAdapter; @@ -54,7 +54,7 @@ import static org.sonar.ce.task.projectanalysis.measure.Measure.newMeasureBuilde * {@link CoreMetrics#NEW_MAINTAINABILITY_RATING_KEY} */ public class NewMaintainabilityMeasuresVisitor extends PathAwareVisitorAdapter<NewMaintainabilityMeasuresVisitor.Counter> { - private static final Logger LOG = Loggers.get(NewMaintainabilityMeasuresVisitor.class); + private static final Logger LOG = LoggerFactory.getLogger(NewMaintainabilityMeasuresVisitor.class); private final MeasureRepository measureRepository; private final NewLinesRepository newLinesRepository; diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/scm/ScmInfoDbLoader.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/scm/ScmInfoDbLoader.java index c4b9eb9d677..72ee6354a89 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/scm/ScmInfoDbLoader.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/scm/ScmInfoDbLoader.java @@ -20,8 +20,8 @@ package org.sonar.ce.task.projectanalysis.scm; import java.util.Optional; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.ce.task.projectanalysis.analysis.AnalysisMetadataHolder; import org.sonar.ce.task.projectanalysis.analysis.Branch; import org.sonar.ce.task.projectanalysis.component.Component; @@ -35,7 +35,7 @@ import org.sonar.db.newcodeperiod.NewCodePeriodType; import org.sonar.db.source.FileSourceDto; public class ScmInfoDbLoader { - private static final Logger LOGGER = Loggers.get(ScmInfoDbLoader.class); + private static final Logger LOGGER = LoggerFactory.getLogger(ScmInfoDbLoader.class); private final AnalysisMetadataHolder analysisMetadataHolder; private final MovedFilesRepository movedFilesRepository; diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/scm/ScmInfoRepositoryImpl.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/scm/ScmInfoRepositoryImpl.java index e166d43bc3b..d1fac26ddd0 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/scm/ScmInfoRepositoryImpl.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/scm/ScmInfoRepositoryImpl.java @@ -25,8 +25,8 @@ import java.util.Map; import java.util.Optional; import javax.annotation.CheckForNull; import javax.annotation.Nullable; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.ce.task.projectanalysis.analysis.AnalysisMetadataHolder; import org.sonar.ce.task.projectanalysis.batch.BatchReportReader; import org.sonar.ce.task.projectanalysis.component.Component; @@ -38,7 +38,7 @@ import static java.util.Objects.requireNonNull; public class ScmInfoRepositoryImpl implements ScmInfoRepository { - private static final Logger LOGGER = Loggers.get(ScmInfoRepositoryImpl.class); + private static final Logger LOGGER = LoggerFactory.getLogger(ScmInfoRepositoryImpl.class); private final BatchReportReader scannerReportReader; private final Map<Component, Optional<ScmInfo>> scmInfoCache = new HashMap<>(); diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/source/SourceLinesDiffFinder.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/source/SourceLinesDiffFinder.java index e4f25651e63..6312ee177d7 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/source/SourceLinesDiffFinder.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/source/SourceLinesDiffFinder.java @@ -23,11 +23,11 @@ import difflib.myers.DifferentiationFailedException; import difflib.myers.MyersDiff; import difflib.myers.PathNode; import java.util.List; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class SourceLinesDiffFinder { - private static final Logger LOG = Loggers.get(SourceLinesDiffFinder.class); + private static final Logger LOG = LoggerFactory.getLogger(SourceLinesDiffFinder.class); public int[] findMatchingLines(List<String> left, List<String> right) { int[] index = new int[right.size()]; diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/source/linereader/HighlightingLineReader.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/source/linereader/HighlightingLineReader.java index 0f2314c8ad3..cc037097e58 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/source/linereader/HighlightingLineReader.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/source/linereader/HighlightingLineReader.java @@ -25,8 +25,8 @@ import java.util.List; import java.util.Map; import java.util.Optional; import javax.annotation.CheckForNull; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.ce.task.projectanalysis.component.Component; import org.sonar.ce.task.projectanalysis.source.linereader.RangeOffsetConverter.RangeOffsetConverterException; import org.sonar.db.protobuf.DbFileSources; @@ -41,7 +41,7 @@ import static org.sonar.ce.task.projectanalysis.source.linereader.RangeOffsetCon public class HighlightingLineReader implements LineReader { - private static final Logger LOG = Loggers.get(HighlightingLineReader.class); + private static final Logger LOG = LoggerFactory.getLogger(HighlightingLineReader.class); private static final Map<HighlightingType, String> cssClassByType = ImmutableMap.<HighlightingType, String>builder() .put(HighlightingType.ANNOTATION, "a") diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/source/linereader/SymbolsLineReader.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/source/linereader/SymbolsLineReader.java index 9f1cdd9b6af..c3d7637c369 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/source/linereader/SymbolsLineReader.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/source/linereader/SymbolsLineReader.java @@ -28,8 +28,8 @@ import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Optional; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.ce.task.projectanalysis.component.Component; import org.sonar.db.protobuf.DbFileSources; import org.sonar.scanner.protocol.output.ScannerReport; @@ -40,7 +40,7 @@ import static org.sonar.ce.task.projectanalysis.source.linereader.RangeOffsetCon public class SymbolsLineReader implements LineReader { - private static final Logger LOG = Loggers.get(SymbolsLineReader.class); + private static final Logger LOG = LoggerFactory.getLogger(SymbolsLineReader.class); private final Component file; private final RangeOffsetConverter rangeOffsetConverter; diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/ExecuteVisitorsStep.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/ExecuteVisitorsStep.java index 2b10b4fbca1..15e1889cfd3 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/ExecuteVisitorsStep.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/ExecuteVisitorsStep.java @@ -21,8 +21,8 @@ package org.sonar.ce.task.projectanalysis.step; import java.util.List; import java.util.Map; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.ce.task.projectanalysis.component.ComponentVisitor; import org.sonar.ce.task.projectanalysis.component.TreeRootHolder; import org.sonar.ce.task.projectanalysis.component.VisitorsCrawler; @@ -30,7 +30,7 @@ import org.sonar.ce.task.step.ComputationStep; public class ExecuteVisitorsStep implements ComputationStep { - private static final Logger LOGGER = Loggers.get(ExecuteVisitorsStep.class); + private static final Logger LOGGER = LoggerFactory.getLogger(ExecuteVisitorsStep.class); private final TreeRootHolder treeRootHolder; private final List<ComponentVisitor> visitors; diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/ExtractReportStep.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/ExtractReportStep.java index 22300f1830f..45c65d11c92 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/ExtractReportStep.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/ExtractReportStep.java @@ -27,8 +27,8 @@ import java.util.Optional; import org.sonar.api.utils.MessageException; import org.sonar.api.utils.TempFolder; import org.sonar.api.utils.ZipUtils; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.ce.task.CeTask; import org.sonar.ce.task.projectanalysis.batch.MutableBatchReportDirectoryHolder; import org.sonar.ce.task.step.ComputationStep; @@ -46,7 +46,7 @@ import static org.sonar.core.util.FileUtils.humanReadableByteCountSI; public class ExtractReportStep implements ComputationStep { static final long REPORT_SIZE_THRESHOLD_IN_BYTES = 4_000_000_000L; - private static final Logger LOGGER = Loggers.get(ExtractReportStep.class); + private static final Logger LOGGER = LoggerFactory.getLogger(ExtractReportStep.class); private final DbClient dbClient; private final CeTask task; diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/IndexAnalysisStep.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/IndexAnalysisStep.java index 739c51716cb..6874fc40ffb 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/IndexAnalysisStep.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/IndexAnalysisStep.java @@ -21,8 +21,8 @@ package org.sonar.ce.task.projectanalysis.step; import java.util.Set; import java.util.function.Consumer; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.ce.task.projectanalysis.component.FileStatuses; import org.sonar.ce.task.projectanalysis.component.TreeRootHolder; import org.sonar.ce.task.step.ComputationStep; @@ -32,7 +32,7 @@ import org.sonar.server.es.ProjectIndexer; public class IndexAnalysisStep implements ComputationStep { - private static final Logger LOGGER = Loggers.get(IndexAnalysisStep.class); + private static final Logger LOGGER = LoggerFactory.getLogger(IndexAnalysisStep.class); private final TreeRootHolder treeRootHolder; private final FileStatuses fileStatuses; diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/LoadCrossProjectDuplicationsRepositoryStep.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/LoadCrossProjectDuplicationsRepositoryStep.java index 0763f91c4a5..6ce60e803c4 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/LoadCrossProjectDuplicationsRepositoryStep.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/LoadCrossProjectDuplicationsRepositoryStep.java @@ -24,8 +24,8 @@ import java.util.Collection; import java.util.List; import java.util.function.Function; import javax.annotation.Nonnull; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.ce.task.projectanalysis.analysis.Analysis; import org.sonar.ce.task.projectanalysis.analysis.AnalysisMetadataHolder; import org.sonar.ce.task.projectanalysis.batch.BatchReportReader; @@ -53,7 +53,7 @@ import org.sonar.scanner.protocol.output.ScannerReport.CpdTextBlock; */ public class LoadCrossProjectDuplicationsRepositoryStep implements ComputationStep { - private static final Logger LOGGER = Loggers.get(LoadCrossProjectDuplicationsRepositoryStep.class); + private static final Logger LOGGER = LoggerFactory.getLogger(LoadCrossProjectDuplicationsRepositoryStep.class); private final TreeRootHolder treeRootHolder; private final BatchReportReader reportReader; diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/PersistPushEventsStep.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/PersistPushEventsStep.java index 6b016fbe001..daeda7e6e1a 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/PersistPushEventsStep.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/PersistPushEventsStep.java @@ -20,8 +20,8 @@ package org.sonar.ce.task.projectanalysis.step; import java.util.Optional; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.ce.task.projectanalysis.component.TreeRootHolder; import org.sonar.ce.task.projectanalysis.issue.ProtoIssueCache; import org.sonar.ce.task.projectanalysis.pushevent.PushEventFactory; @@ -34,7 +34,7 @@ import org.sonar.db.pushevent.PushEventDto; public class PersistPushEventsStep implements ComputationStep { private static final int MAX_BATCH_SIZE = 250; - private static final Logger LOGGER = Loggers.get(PersistPushEventsStep.class); + private static final Logger LOGGER = LoggerFactory.getLogger(PersistPushEventsStep.class); private final DbClient dbClient; private final ProtoIssueCache protoIssueCache; diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/PersistScannerAnalysisCacheStep.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/PersistScannerAnalysisCacheStep.java index 20e52e7d293..ccc1cd97d07 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/PersistScannerAnalysisCacheStep.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/PersistScannerAnalysisCacheStep.java @@ -21,15 +21,15 @@ package org.sonar.ce.task.projectanalysis.step; import java.io.IOException; import java.io.InputStream; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.ce.task.projectanalysis.batch.BatchReportReader; import org.sonar.ce.task.projectanalysis.component.TreeRootHolder; import org.sonar.ce.task.step.ComputationStep; import org.sonar.db.DbClient; public class PersistScannerAnalysisCacheStep implements ComputationStep { - private static final Logger LOGGER = Loggers.get(PersistScannerAnalysisCacheStep.class); + private static final Logger LOGGER = LoggerFactory.getLogger(PersistScannerAnalysisCacheStep.class); private final BatchReportReader reportReader; private final DbClient dbClient; private final TreeRootHolder treeRootHolder; diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/QualityGateEventsStep.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/QualityGateEventsStep.java index f2b3fa9df87..d2e8546c7ca 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/QualityGateEventsStep.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/QualityGateEventsStep.java @@ -20,8 +20,8 @@ package org.sonar.ce.task.projectanalysis.step; import org.sonar.api.measures.CoreMetrics; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.ce.task.projectanalysis.analysis.AnalysisMetadataHolder; import org.sonar.ce.task.projectanalysis.analysis.Branch; import org.sonar.ce.task.projectanalysis.component.Component; @@ -52,7 +52,7 @@ import java.util.stream.Collectors; * This step must be executed after computation of quality gate measure {@link QualityGateMeasuresStep} */ public class QualityGateEventsStep implements ComputationStep { - private static final Logger LOGGER = Loggers.get(QualityGateEventsStep.class); + private static final Logger LOGGER = LoggerFactory.getLogger(QualityGateEventsStep.class); private final TreeRootHolder treeRootHolder; private final MetricRepository metricRepository; diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/taskprocessor/AuditPurgeStep.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/taskprocessor/AuditPurgeStep.java index e23e2b1fbfc..37757ad8f7a 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/taskprocessor/AuditPurgeStep.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/taskprocessor/AuditPurgeStep.java @@ -19,8 +19,8 @@ */ package org.sonar.ce.task.projectanalysis.taskprocessor; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.ce.task.step.ComputationStep; import org.sonar.core.util.logs.Profiler; import org.sonar.db.DbClient; @@ -30,7 +30,7 @@ import org.sonar.db.property.PropertyDto; import static java.lang.String.format; public final class AuditPurgeStep implements ComputationStep { - private static final Logger LOG = Loggers.get(AuditPurgeStep.class); + private static final Logger LOG = LoggerFactory.getLogger(AuditPurgeStep.class); private final AuditHousekeepingFrequencyHelper auditHousekeepingFrequencyHelper; private final DbClient dbClient; diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/taskprocessor/IgnoreOrphanBranchStep.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/taskprocessor/IgnoreOrphanBranchStep.java index d1d13d7daed..4790834cdd4 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/taskprocessor/IgnoreOrphanBranchStep.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/taskprocessor/IgnoreOrphanBranchStep.java @@ -20,8 +20,8 @@ package org.sonar.ce.task.projectanalysis.taskprocessor; import java.util.Optional; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.ce.task.CeTask; import org.sonar.ce.task.step.ComputationStep; import org.sonar.db.DbClient; @@ -29,7 +29,7 @@ import org.sonar.db.DbSession; import org.sonar.db.component.ComponentDto; public final class IgnoreOrphanBranchStep implements ComputationStep { - private static final Logger LOG = Loggers.get(IgnoreOrphanBranchStep.class); + private static final Logger LOG = LoggerFactory.getLogger(IgnoreOrphanBranchStep.class); private final CeTask ceTask; private final DbClient dbClient; diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/taskprocessor/IndexIssuesStep.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/taskprocessor/IndexIssuesStep.java index 985c1d46d27..8305d58b655 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/taskprocessor/IndexIssuesStep.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/taskprocessor/IndexIssuesStep.java @@ -19,8 +19,8 @@ */ package org.sonar.ce.task.projectanalysis.taskprocessor; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.ce.task.CeTask; import org.sonar.ce.task.step.ComputationStep; import org.sonar.db.DbClient; @@ -28,7 +28,7 @@ import org.sonar.db.DbSession; import org.sonar.server.issue.index.IssueIndexer; public final class IndexIssuesStep implements ComputationStep { - private static final Logger LOG = Loggers.get(IndexIssuesStep.class); + private static final Logger LOG = LoggerFactory.getLogger(IndexIssuesStep.class); private final CeTask ceTask; private final DbClient dbClient; private final IssueIndexer issueIndexer; diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/analysis/ExportAnalysesStep.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/analysis/ExportAnalysesStep.java index 1b566f85d8b..5d88ab818b6 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/analysis/ExportAnalysesStep.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/analysis/ExportAnalysesStep.java @@ -23,7 +23,7 @@ import com.sonarsource.governance.projectdump.protobuf.ProjectDump; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.LoggerFactory; import org.sonar.ce.task.projectexport.component.ComponentRepository; import org.sonar.ce.task.projectexport.steps.DumpElement; import org.sonar.ce.task.projectexport.steps.DumpWriter; @@ -83,7 +83,7 @@ public class ExportAnalysesStep implements ComputationStep { output.write(analysis); count++; } - Loggers.get(getClass()).debug("{} analyses exported", count); + LoggerFactory.getLogger(getClass()).debug("{} analyses exported", count); } catch (Exception e) { throw new IllegalStateException(format("Analysis Export failed after processing %d analyses successfully", count), e); diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/branches/ExportBranchesStep.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/branches/ExportBranchesStep.java index cc756bec6fc..f1e5aad62ae 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/branches/ExportBranchesStep.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/branches/ExportBranchesStep.java @@ -21,7 +21,7 @@ package org.sonar.ce.task.projectexport.branches; import com.sonarsource.governance.projectdump.protobuf.ProjectDump; import java.util.List; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.LoggerFactory; import org.sonar.ce.task.projectexport.steps.DumpElement; import org.sonar.ce.task.projectexport.steps.DumpWriter; import org.sonar.ce.task.projectexport.steps.ProjectHolder; @@ -67,7 +67,7 @@ public class ExportBranchesStep implements ComputationStep { output.write(builder.build()); ++count; } - Loggers.get(getClass()).debug("{} branches exported", count); + LoggerFactory.getLogger(getClass()).debug("{} branches exported", count); } } catch (Exception e) { throw new IllegalStateException(format("Branch export failed after processing %d branch(es) successfully", count), e); diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/component/ExportComponentsStep.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/component/ExportComponentsStep.java index eded9dd12d1..b3700c446fa 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/component/ExportComponentsStep.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/component/ExportComponentsStep.java @@ -24,7 +24,7 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import org.sonar.api.resources.Qualifiers; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.LoggerFactory; import org.sonar.ce.task.projectexport.steps.DumpElement; import org.sonar.ce.task.projectexport.steps.DumpWriter; import org.sonar.ce.task.projectexport.steps.ProjectHolder; @@ -97,7 +97,7 @@ public class ExportComponentsStep implements ComputationStep { ref++; count++; } - Loggers.get(getClass()).debug("{} components exported", count); + LoggerFactory.getLogger(getClass()).debug("{} components exported", count); } catch (Exception e) { throw new IllegalStateException(format("Component Export failed after processing %d components successfully", count), e); } diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/file/ExportLineHashesStep.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/file/ExportLineHashesStep.java index f2bde0fbc8a..c9a97c98f50 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/file/ExportLineHashesStep.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/file/ExportLineHashesStep.java @@ -25,7 +25,7 @@ import java.sql.ResultSet; import java.sql.SQLException; import java.util.List; import java.util.Set; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.LoggerFactory; import org.sonar.ce.task.projectexport.component.ComponentRepository; import org.sonar.ce.task.projectexport.steps.DumpElement; import org.sonar.ce.task.projectexport.steps.DumpWriter; @@ -81,7 +81,7 @@ public class ExportLineHashesStep implements ComputationStep { closeQuietly(rs); closeQuietly(stmt); } - Loggers.get(getClass()).debug("Lines hashes of {} files exported", count); + LoggerFactory.getLogger(getClass()).debug("Lines hashes of {} files exported", count); } catch (Exception e) { throw new IllegalStateException(format("Lines hashes export failed after processing %d files successfully", count), e); } finally { diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/issue/ExportIssuesChangelogStep.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/issue/ExportIssuesChangelogStep.java index 7360c13c013..2bf7818d3dc 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/issue/ExportIssuesChangelogStep.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/issue/ExportIssuesChangelogStep.java @@ -23,7 +23,7 @@ import com.sonarsource.governance.projectdump.protobuf.ProjectDump; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.LoggerFactory; import org.sonar.ce.task.projectexport.steps.DumpElement; import org.sonar.ce.task.projectexport.steps.DumpWriter; import org.sonar.ce.task.projectexport.steps.ProjectHolder; @@ -79,7 +79,7 @@ public class ExportIssuesChangelogStep implements ComputationStep { output.write(issue); count++; } - Loggers.get(getClass()).debug("{} issue changes exported", count); + LoggerFactory.getLogger(getClass()).debug("{} issue changes exported", count); } catch (Exception e) { throw new IllegalStateException(format("Issues changelog export failed after processing %d issue changes successfully", count), e); } diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/issue/ExportIssuesStep.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/issue/ExportIssuesStep.java index 17655c74112..423bd3d5064 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/issue/ExportIssuesStep.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/issue/ExportIssuesStep.java @@ -30,7 +30,7 @@ import java.util.List; import java.util.Objects; import java.util.Optional; import org.sonar.api.rule.RuleKey; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.LoggerFactory; import org.sonar.ce.task.projectexport.component.ComponentRepository; import org.sonar.ce.task.projectexport.rule.Rule; import org.sonar.ce.task.projectexport.rule.RuleRepository; @@ -104,7 +104,7 @@ public class ExportIssuesStep implements ComputationStep { output.write(issue); count++; } - Loggers.get(getClass()).debug("{} issues exported", count); + LoggerFactory.getLogger(getClass()).debug("{} issues exported", count); } catch (Exception e) { throw new IllegalStateException(format("Issue export failed after processing %d issues successfully", count), e); } diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/rule/ExportAdHocRulesStep.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/rule/ExportAdHocRulesStep.java index 42d28d53d70..56903e2916a 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/rule/ExportAdHocRulesStep.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/rule/ExportAdHocRulesStep.java @@ -23,7 +23,7 @@ import com.sonarsource.governance.projectdump.protobuf.ProjectDump; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.LoggerFactory; import org.sonar.ce.task.projectexport.steps.DumpElement; import org.sonar.ce.task.projectexport.steps.DumpWriter; import org.sonar.ce.task.projectexport.steps.ProjectHolder; @@ -81,7 +81,7 @@ public class ExportAdHocRulesStep implements ComputationStep { output.write(rule); count++; } - Loggers.get(getClass()).debug("{} ad-hoc rules exported", count); + LoggerFactory.getLogger(getClass()).debug("{} ad-hoc rules exported", count); } } catch (Exception e) { throw new IllegalStateException(format("Ad-hoc rules export failed after processing %d rules successfully", count), e); diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/rule/ExportRuleStep.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/rule/ExportRuleStep.java index 6367ddbcbc9..d1001ded89d 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/rule/ExportRuleStep.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/rule/ExportRuleStep.java @@ -20,7 +20,7 @@ package org.sonar.ce.task.projectexport.rule; import com.sonarsource.governance.projectdump.protobuf.ProjectDump; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.LoggerFactory; import org.sonar.ce.task.projectexport.steps.DumpElement; import org.sonar.ce.task.projectexport.steps.DumpWriter; import org.sonar.ce.task.projectexport.steps.StreamWriter; @@ -52,7 +52,7 @@ public class ExportRuleStep implements ComputationStep { writer.write(ruleMessage); count++; } - Loggers.get(getClass()).debug("{} rules exported", count); + LoggerFactory.getLogger(getClass()).debug("{} rules exported", count); } catch (Exception e) { throw new IllegalStateException(format("Rule Export failed after processing %d rules successfully", count), e); } diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/steps/DumpWriterImpl.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/steps/DumpWriterImpl.java index d72377840af..440df8f7111 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/steps/DumpWriterImpl.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/steps/DumpWriterImpl.java @@ -26,7 +26,7 @@ import java.io.FileOutputStream; import java.io.IOException; import java.util.concurrent.atomic.AtomicBoolean; import org.sonar.api.utils.TempFolder; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.LoggerFactory; import org.sonar.ce.task.projectexport.taskprocessor.ProjectDescriptor; import org.sonar.ce.task.projectexport.util.ProjectExportDumpFS; @@ -88,7 +88,7 @@ public class DumpWriterImpl implements DumpWriter { FILES2.deleteIfExists(targetZip); FILES2.moveFile(zip, targetZip); FILES2.deleteIfExists(rootDir); - Loggers.get(getClass()).info("Dump file published | size={} | path={}", humanReadableByteCountSI(sizeOf(targetZip)), targetZip.getAbsolutePath()); + LoggerFactory.getLogger(getClass()).info("Dump file published | size={} | path={}", humanReadableByteCountSI(sizeOf(targetZip)), targetZip.getAbsolutePath()); published.set(true); } diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/steps/ExportEventsStep.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/steps/ExportEventsStep.java index e3e4e2776b3..e4e9f97ed2d 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/steps/ExportEventsStep.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/steps/ExportEventsStep.java @@ -23,7 +23,7 @@ import com.sonarsource.governance.projectdump.protobuf.ProjectDump; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.LoggerFactory; import org.sonar.ce.task.projectexport.component.ComponentRepository; import org.sonar.ce.task.step.ComputationStep; import org.sonar.db.DatabaseUtils; @@ -72,7 +72,7 @@ public class ExportEventsStep implements ComputationStep { output.write(event); count++; } - Loggers.get(getClass()).debug("{} events exported", count); + LoggerFactory.getLogger(getClass()).debug("{} events exported", count); } catch (Exception e) { throw new IllegalStateException(format("Event Export failed after processing %d events successfully", count), e); diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/steps/ExportLinksStep.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/steps/ExportLinksStep.java index ec20d45627e..d0b96486d88 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/steps/ExportLinksStep.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/steps/ExportLinksStep.java @@ -21,7 +21,7 @@ package org.sonar.ce.task.projectexport.steps; import com.sonarsource.governance.projectdump.protobuf.ProjectDump; import java.util.List; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.LoggerFactory; import org.sonar.ce.task.projectexport.component.ComponentRepository; import org.sonar.ce.task.step.ComputationStep; import org.sonar.db.DbClient; @@ -67,7 +67,7 @@ public class ExportLinksStep implements ComputationStep { ++count; } - Loggers.get(getClass()).debug("{} links exported", count); + LoggerFactory.getLogger(getClass()).debug("{} links exported", count); } } catch (Exception e) { throw new IllegalStateException(format("Link export failed after processing %d link(s) successfully", count), e); diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/steps/ExportLiveMeasuresStep.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/steps/ExportLiveMeasuresStep.java index 0a37ac6f0a0..7537377a23a 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/steps/ExportLiveMeasuresStep.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/steps/ExportLiveMeasuresStep.java @@ -23,7 +23,7 @@ import com.sonarsource.governance.projectdump.protobuf.ProjectDump; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.LoggerFactory; import org.sonar.ce.task.projectexport.component.ComponentRepository; import org.sonar.ce.task.step.ComputationStep; import org.sonar.db.DbClient; @@ -78,7 +78,7 @@ public class ExportLiveMeasuresStep implements ComputationStep { output.write(measure); count++; } - Loggers.get(getClass()).debug("{} live measures exported", count); + LoggerFactory.getLogger(getClass()).debug("{} live measures exported", count); } } catch (Exception e) { throw new IllegalStateException(format("Live Measure Export failed after processing %d measures successfully", count), e); diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/steps/ExportMeasuresStep.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/steps/ExportMeasuresStep.java index 66bcd3710c1..314dc29742d 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/steps/ExportMeasuresStep.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/steps/ExportMeasuresStep.java @@ -23,7 +23,7 @@ import com.sonarsource.governance.projectdump.protobuf.ProjectDump; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.LoggerFactory; import org.sonar.ce.task.projectexport.component.ComponentRepository; import org.sonar.ce.task.step.ComputationStep; import org.sonar.db.DatabaseUtils; @@ -79,7 +79,7 @@ public class ExportMeasuresStep implements ComputationStep { output.write(measure); count++; } - Loggers.get(getClass()).debug("{} measures exported", count); + LoggerFactory.getLogger(getClass()).debug("{} measures exported", count); } catch (Exception e) { throw new IllegalStateException(format("Measure Export failed after processing %d measures successfully", count), e); } diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/steps/ExportMetricsStep.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/steps/ExportMetricsStep.java index 9b305d7e497..84fe3479046 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/steps/ExportMetricsStep.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/steps/ExportMetricsStep.java @@ -22,7 +22,7 @@ package org.sonar.ce.task.projectexport.steps; import com.sonarsource.governance.projectdump.protobuf.ProjectDump; import java.util.List; import java.util.Map; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.LoggerFactory; import org.sonar.ce.task.step.ComputationStep; import org.sonar.db.DbClient; import org.sonar.db.DbSession; @@ -62,7 +62,7 @@ public class ExportMetricsStep implements ComputationStep { output.write(builder.build()); count++; } - Loggers.get(getClass()).debug("{} metrics exported", count); + LoggerFactory.getLogger(getClass()).debug("{} metrics exported", count); } catch (Exception e) { throw new IllegalStateException(format("Metric Export failed after processing %d metrics successfully", count), e); } diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/steps/ExportNewCodePeriodsStep.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/steps/ExportNewCodePeriodsStep.java index c7d12fb4d9a..ed2ee7a06be 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/steps/ExportNewCodePeriodsStep.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/steps/ExportNewCodePeriodsStep.java @@ -21,7 +21,7 @@ package org.sonar.ce.task.projectexport.steps; import com.sonarsource.governance.projectdump.protobuf.ProjectDump; import java.util.List; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.LoggerFactory; import org.sonar.ce.task.step.ComputationStep; import org.sonar.db.DbClient; import org.sonar.db.DbSession; @@ -69,7 +69,7 @@ public class ExportNewCodePeriodsStep implements ComputationStep { ++count; } - Loggers.get(getClass()).debug("{} new code periods exported", count); + LoggerFactory.getLogger(getClass()).debug("{} new code periods exported", count); } catch (Exception e) { throw new IllegalStateException(format("New Code Periods Export failed after processing %d new code periods successfully", count), e); } diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/steps/ExportPluginsStep.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/steps/ExportPluginsStep.java index f2f40c5d0f5..2854fdf26bf 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/steps/ExportPluginsStep.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/steps/ExportPluginsStep.java @@ -22,7 +22,7 @@ package org.sonar.ce.task.projectexport.steps; import com.sonarsource.governance.projectdump.protobuf.ProjectDump; import java.util.Collection; import org.apache.commons.lang.StringUtils; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.LoggerFactory; import org.sonar.ce.task.step.ComputationStep; import org.sonar.core.platform.PluginInfo; import org.sonar.core.platform.PluginRepository; @@ -47,7 +47,7 @@ public class ExportPluginsStep implements ComputationStep { ProjectDump.Plugin.Builder builder = ProjectDump.Plugin.newBuilder(); writer.write(convert(plugin, builder)); } - Loggers.get(getClass()).debug("{} plugins exported", plugins.size()); + LoggerFactory.getLogger(getClass()).debug("{} plugins exported", plugins.size()); } } diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/steps/ExportSettingsStep.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/steps/ExportSettingsStep.java index e8444f23225..092b7b35e65 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/steps/ExportSettingsStep.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/steps/ExportSettingsStep.java @@ -22,7 +22,7 @@ package org.sonar.ce.task.projectexport.steps; import com.sonarsource.governance.projectdump.protobuf.ProjectDump; import java.util.List; import java.util.Set; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.LoggerFactory; import org.sonar.ce.task.projectexport.component.ComponentRepository; import org.sonar.ce.task.step.ComputationStep; import org.sonar.db.DbClient; @@ -78,7 +78,7 @@ public class ExportSettingsStep implements ComputationStep { ++count; } - Loggers.get(getClass()).debug("{} settings exported", count); + LoggerFactory.getLogger(getClass()).debug("{} settings exported", count); } catch (Exception e) { throw new IllegalStateException(format("Settings Export failed after processing %d settings successfully", count), e); } diff --git a/server/sonar-ce-task/src/main/java/org/sonar/ce/task/container/TaskContainerImpl.java b/server/sonar-ce-task/src/main/java/org/sonar/ce/task/container/TaskContainerImpl.java index f9711d76d40..c8a2441e45e 100644 --- a/server/sonar-ce-task/src/main/java/org/sonar/ce/task/container/TaskContainerImpl.java +++ b/server/sonar-ce-task/src/main/java/org/sonar/ce/task/container/TaskContainerImpl.java @@ -19,7 +19,7 @@ */ package org.sonar.ce.task.container; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.LoggerFactory; import org.sonar.core.platform.ContainerPopulator; import org.sonar.core.platform.SpringComponentContainer; @@ -51,7 +51,7 @@ public class TaskContainerImpl extends SpringComponentContainer implements TaskC try { stopComponents(); } catch (Throwable t) { - Loggers.get(TaskContainerImpl.class).error("Cleanup of container failed", t); + LoggerFactory.getLogger(TaskContainerImpl.class).error("Cleanup of container failed", t); } } } diff --git a/server/sonar-ce-task/src/main/java/org/sonar/ce/task/step/ComputationStepExecutor.java b/server/sonar-ce-task/src/main/java/org/sonar/ce/task/step/ComputationStepExecutor.java index 5ead92b611a..bd75567c842 100644 --- a/server/sonar-ce-task/src/main/java/org/sonar/ce/task/step/ComputationStepExecutor.java +++ b/server/sonar-ce-task/src/main/java/org/sonar/ce/task/step/ComputationStepExecutor.java @@ -21,8 +21,8 @@ package org.sonar.ce.task.step; import javax.annotation.CheckForNull; import javax.annotation.Nullable; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.ce.task.CeTaskInterrupter; import org.sonar.core.util.logs.Profiler; import org.springframework.beans.factory.annotation.Autowired; @@ -32,7 +32,7 @@ import static java.lang.String.format; import static java.util.Objects.requireNonNull; public final class ComputationStepExecutor { - private static final Logger LOGGER = Loggers.get(ComputationStepExecutor.class); + private static final Logger LOGGER = LoggerFactory.getLogger(ComputationStepExecutor.class); private final ComputationSteps steps; private final CeTaskInterrupter taskInterrupter; diff --git a/server/sonar-ce/src/main/java/org/sonar/ce/CeDistributedInformationImpl.java b/server/sonar-ce/src/main/java/org/sonar/ce/CeDistributedInformationImpl.java index e85994563b3..2786a0cb82f 100644 --- a/server/sonar-ce/src/main/java/org/sonar/ce/CeDistributedInformationImpl.java +++ b/server/sonar-ce/src/main/java/org/sonar/ce/CeDistributedInformationImpl.java @@ -25,8 +25,8 @@ import java.util.Set; import java.util.UUID; import java.util.concurrent.locks.Lock; import org.sonar.api.Startable; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.ce.taskprocessor.CeWorker; import org.sonar.ce.taskprocessor.CeWorkerFactory; import org.sonar.process.cluster.hz.HazelcastMember; @@ -39,7 +39,7 @@ import static org.sonar.process.cluster.hz.HazelcastObjects.WORKER_UUIDS; * Provide the set of worker's UUID in a clustered SonarQube instance */ public class CeDistributedInformationImpl implements CeDistributedInformation, Startable { - private static final Logger LOGGER = Loggers.get(CeDistributedInformationImpl.class); + private static final Logger LOGGER = LoggerFactory.getLogger(CeDistributedInformationImpl.class); private final HazelcastMember hazelcastMember; private final CeWorkerFactory ceCeWorkerFactory; diff --git a/server/sonar-ce/src/main/java/org/sonar/ce/app/CeServer.java b/server/sonar-ce/src/main/java/org/sonar/ce/app/CeServer.java index 0ddf9b6083c..5585e3c4025 100644 --- a/server/sonar-ce/src/main/java/org/sonar/ce/app/CeServer.java +++ b/server/sonar-ce/src/main/java/org/sonar/ce/app/CeServer.java @@ -23,8 +23,8 @@ import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.ImmutableMap; import java.util.concurrent.CountDownLatch; import javax.annotation.Nullable; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.ce.ComputeEngine; import org.sonar.ce.ComputeEngineImpl; import org.sonar.ce.container.ComputeEngineContainerImpl; @@ -46,7 +46,7 @@ import static org.sonar.process.ProcessId.COMPUTE_ENGINE; * </p> */ public class CeServer implements Monitored { - private static final Logger LOG = Loggers.get(CeServer.class); + private static final Logger LOG = LoggerFactory.getLogger(CeServer.class); private static final String CE_MAIN_THREAD_NAME = "ce-main"; diff --git a/server/sonar-ce/src/main/java/org/sonar/ce/cleaning/CeCleaningSchedulerImpl.java b/server/sonar-ce/src/main/java/org/sonar/ce/cleaning/CeCleaningSchedulerImpl.java index 54c1f3401c0..a5cf5dd38ef 100644 --- a/server/sonar-ce/src/main/java/org/sonar/ce/cleaning/CeCleaningSchedulerImpl.java +++ b/server/sonar-ce/src/main/java/org/sonar/ce/cleaning/CeCleaningSchedulerImpl.java @@ -20,8 +20,8 @@ package org.sonar.ce.cleaning; import java.util.concurrent.locks.Lock; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.ce.CeDistributedInformation; import org.sonar.ce.configuration.CeConfiguration; import org.sonar.ce.queue.InternalCeQueue; @@ -29,7 +29,7 @@ import org.sonar.ce.queue.InternalCeQueue; import static java.util.concurrent.TimeUnit.MINUTES; public class CeCleaningSchedulerImpl implements CeCleaningScheduler { - private static final Logger LOG = Loggers.get(CeCleaningSchedulerImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(CeCleaningSchedulerImpl.class); private final CeCleaningExecutorService executorService; private final CeConfiguration ceConfiguration; diff --git a/server/sonar-ce/src/main/java/org/sonar/ce/configuration/CeWorkerCountSettingWarning.java b/server/sonar-ce/src/main/java/org/sonar/ce/configuration/CeWorkerCountSettingWarning.java index 26e22f34a73..30e8d6ac194 100644 --- a/server/sonar-ce/src/main/java/org/sonar/ce/configuration/CeWorkerCountSettingWarning.java +++ b/server/sonar-ce/src/main/java/org/sonar/ce/configuration/CeWorkerCountSettingWarning.java @@ -21,8 +21,8 @@ package org.sonar.ce.configuration; import org.sonar.api.Startable; import org.sonar.api.config.Configuration; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Displays a warning in the logs if property "sonar.ce.workerCount" is defined as it has been replaced @@ -30,7 +30,7 @@ import org.sonar.api.utils.log.Loggers; */ public class CeWorkerCountSettingWarning implements Startable { private static final String PROPERTY_SONAR_CE_WORKER_COUNT = "sonar.ce.workerCount"; - private static final Logger LOG = Loggers.get(CeWorkerCountSettingWarning.class); + private static final Logger LOG = LoggerFactory.getLogger(CeWorkerCountSettingWarning.class); private final Configuration configuration; diff --git a/server/sonar-ce/src/main/java/org/sonar/ce/container/CePluginRepository.java b/server/sonar-ce/src/main/java/org/sonar/ce/container/CePluginRepository.java index 0be687c23ef..c1d8eb7c26a 100644 --- a/server/sonar-ce/src/main/java/org/sonar/ce/container/CePluginRepository.java +++ b/server/sonar-ce/src/main/java/org/sonar/ce/container/CePluginRepository.java @@ -30,7 +30,7 @@ import java.util.stream.Collectors; import org.apache.commons.io.FileUtils; import org.sonar.api.Plugin; import org.sonar.api.Startable; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.LoggerFactory; import org.sonar.core.platform.ExplodedPlugin; import org.sonar.core.platform.PluginClassLoader; import org.sonar.core.platform.PluginInfo; @@ -68,7 +68,7 @@ public class CePluginRepository implements PluginRepository, Startable { @Override public void start() { - Loggers.get(getClass()).info("Load plugins"); + LoggerFactory.getLogger(getClass()).info("Load plugins"); registerPluginsFromDir(fs.getInstalledBundledPluginsDir()); registerPluginsFromDir(fs.getInstalledExternalPluginsDir()); diff --git a/server/sonar-ce/src/main/java/org/sonar/ce/container/ComputeEngineContainerImpl.java b/server/sonar-ce/src/main/java/org/sonar/ce/container/ComputeEngineContainerImpl.java index d9b98480083..182942cd836 100644 --- a/server/sonar-ce/src/main/java/org/sonar/ce/container/ComputeEngineContainerImpl.java +++ b/server/sonar-ce/src/main/java/org/sonar/ce/container/ComputeEngineContainerImpl.java @@ -38,7 +38,7 @@ import org.sonar.api.utils.Durations; import org.sonar.api.utils.System2; import org.sonar.api.utils.UriReader; import org.sonar.api.utils.Version; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.LoggerFactory; import org.sonar.ce.CeConfigurationModule; import org.sonar.ce.CeDistributedInformationImpl; import org.sonar.ce.CeHttpModule; @@ -225,7 +225,7 @@ public class ComputeEngineContainerImpl implements ComputeEngineContainer { level4.startComponents(); PlatformEditionProvider editionProvider = level4.getComponentByType(PlatformEditionProvider.class); - Loggers.get(ComputeEngineContainerImpl.class) + LoggerFactory.getLogger(ComputeEngineContainerImpl.class) .info("Running {} edition", editionProvider.get().map(EditionProvider.Edition::getLabel).orElse("")); } diff --git a/server/sonar-ce/src/main/java/org/sonar/ce/logging/ChangeLogLevelHttpAction.java b/server/sonar-ce/src/main/java/org/sonar/ce/logging/ChangeLogLevelHttpAction.java index e5f4aa028ec..9576a88b008 100644 --- a/server/sonar-ce/src/main/java/org/sonar/ce/logging/ChangeLogLevelHttpAction.java +++ b/server/sonar-ce/src/main/java/org/sonar/ce/logging/ChangeLogLevelHttpAction.java @@ -33,7 +33,7 @@ import org.apache.http.NameValuePair; import org.apache.http.client.utils.URLEncodedUtils; import org.apache.http.entity.StringEntity; import org.sonar.api.utils.log.LoggerLevel; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.LoggerFactory; import org.sonar.ce.httpd.HttpAction; import org.sonar.server.log.ServerLogging; @@ -90,7 +90,7 @@ public class ChangeLogLevelHttpAction implements HttpAction { logging.changeLevel(level); response.setStatusLine(HttpVersion.HTTP_1_1, HttpStatus.SC_OK); } catch (IllegalArgumentException e) { - Loggers.get(ChangeLogLevelHttpAction.class).debug("Value '{}' for parameter '" + PARAM_LEVEL + "' is invalid: {}", levelStr, e); + LoggerFactory.getLogger(ChangeLogLevelHttpAction.class).debug("Value '{}' for parameter '" + PARAM_LEVEL + "' is invalid: {}", levelStr, e); response.setStatusLine(HttpVersion.HTTP_1_1, HttpStatus.SC_BAD_REQUEST); response.setEntity( new StringEntity(format("Value '%s' for parameter '%s' is invalid", levelStr, PARAM_LEVEL), StandardCharsets.UTF_8)); diff --git a/server/sonar-ce/src/main/java/org/sonar/ce/queue/InternalCeQueueImpl.java b/server/sonar-ce/src/main/java/org/sonar/ce/queue/InternalCeQueueImpl.java index 062216822a9..51092ed94cc 100644 --- a/server/sonar-ce/src/main/java/org/sonar/ce/queue/InternalCeQueueImpl.java +++ b/server/sonar-ce/src/main/java/org/sonar/ce/queue/InternalCeQueueImpl.java @@ -32,8 +32,8 @@ import javax.annotation.Nullable; import org.sonar.api.ce.ComputeEngineSide; import org.sonar.api.utils.System2; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.ce.container.ComputeEngineStatus; import org.sonar.ce.monitoring.CEQueueStatus; import org.sonar.ce.task.CeTask; @@ -58,7 +58,7 @@ import static org.sonar.core.util.stream.MoreCollectors.uniqueIndex; @ComputeEngineSide public class InternalCeQueueImpl extends CeQueueImpl implements InternalCeQueue { - private static final Logger LOG = Loggers.get(InternalCeQueueImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(InternalCeQueueImpl.class); private final DbClient dbClient; private final CEQueueStatus queueStatus; diff --git a/server/sonar-ce/src/main/java/org/sonar/ce/queue/NextPendingTaskPicker.java b/server/sonar-ce/src/main/java/org/sonar/ce/queue/NextPendingTaskPicker.java index 50e0068ad8b..897267552ee 100644 --- a/server/sonar-ce/src/main/java/org/sonar/ce/queue/NextPendingTaskPicker.java +++ b/server/sonar-ce/src/main/java/org/sonar/ce/queue/NextPendingTaskPicker.java @@ -28,8 +28,8 @@ import javax.annotation.Nullable; import org.apache.commons.lang.ObjectUtils; import org.sonar.api.ce.ComputeEngineSide; import org.sonar.api.config.Configuration; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.core.config.ComputeEngineProperties; import org.sonar.db.DbClient; import org.sonar.db.DbSession; @@ -43,7 +43,7 @@ import static org.sonar.db.ce.CeTaskCharacteristicDto.PULL_REQUEST; @ComputeEngineSide public class NextPendingTaskPicker { - private static final Logger LOG = Loggers.get(NextPendingTaskPicker.class); + private static final Logger LOG = LoggerFactory.getLogger(NextPendingTaskPicker.class); private final Configuration config; private final CeQueueDao ceQueueDao; diff --git a/server/sonar-ce/src/main/java/org/sonar/ce/taskprocessor/CeProcessingSchedulerImpl.java b/server/sonar-ce/src/main/java/org/sonar/ce/taskprocessor/CeProcessingSchedulerImpl.java index 79cb094ab78..58ddbd961d6 100644 --- a/server/sonar-ce/src/main/java/org/sonar/ce/taskprocessor/CeProcessingSchedulerImpl.java +++ b/server/sonar-ce/src/main/java/org/sonar/ce/taskprocessor/CeProcessingSchedulerImpl.java @@ -28,15 +28,15 @@ import java.util.Arrays; import java.util.concurrent.TimeUnit; import javax.annotation.CheckForNull; import javax.annotation.Nullable; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.ce.configuration.CeConfiguration; import static com.google.common.util.concurrent.Futures.addCallback; import static java.util.concurrent.TimeUnit.MILLISECONDS; public class CeProcessingSchedulerImpl implements CeProcessingScheduler { - private static final Logger LOG = Loggers.get(CeProcessingSchedulerImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(CeProcessingSchedulerImpl.class); // 30 seconds private static final long DELAY_BETWEEN_DISABLED_TASKS = 30 * 1000L; diff --git a/server/sonar-ce/src/main/java/org/sonar/ce/taskprocessor/CeWorkerControllerImpl.java b/server/sonar-ce/src/main/java/org/sonar/ce/taskprocessor/CeWorkerControllerImpl.java index ceb27b4213c..037630b42ff 100644 --- a/server/sonar-ce/src/main/java/org/sonar/ce/taskprocessor/CeWorkerControllerImpl.java +++ b/server/sonar-ce/src/main/java/org/sonar/ce/taskprocessor/CeWorkerControllerImpl.java @@ -21,7 +21,7 @@ package org.sonar.ce.taskprocessor; import java.util.Optional; import java.util.concurrent.ConcurrentHashMap; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.LoggerFactory; import org.sonar.ce.configuration.CeConfiguration; public class CeWorkerControllerImpl implements CeWorkerController { @@ -40,7 +40,7 @@ public class CeWorkerControllerImpl implements CeWorkerController { private void logEnabledWorkerCount() { int workerCount = ceConfiguration.getWorkerCount(); if (workerCount > 1) { - Loggers.get(CeWorkerController.class).info("Compute Engine will use {} concurrent workers to process tasks", workerCount); + LoggerFactory.getLogger(CeWorkerController.class).info("Compute Engine will use {} concurrent workers to process tasks", workerCount); } } diff --git a/server/sonar-ce/src/main/java/org/sonar/ce/taskprocessor/CeWorkerImpl.java b/server/sonar-ce/src/main/java/org/sonar/ce/taskprocessor/CeWorkerImpl.java index 917a6fe582b..a5f5d0e728d 100644 --- a/server/sonar-ce/src/main/java/org/sonar/ce/taskprocessor/CeWorkerImpl.java +++ b/server/sonar-ce/src/main/java/org/sonar/ce/taskprocessor/CeWorkerImpl.java @@ -32,8 +32,8 @@ import java.util.function.Supplier; import javax.annotation.CheckForNull; import javax.annotation.Nullable; import org.sonar.api.utils.MessageException; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.ce.queue.InternalCeQueue; import org.sonar.ce.task.CeTask; import org.sonar.ce.task.CeTaskInterruptedException; @@ -52,7 +52,7 @@ import static org.sonar.db.ce.CeActivityDto.Status.FAILED; public class CeWorkerImpl implements CeWorker { - private static final Logger LOG = Loggers.get(CeWorkerImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(CeWorkerImpl.class); private final int ordinal; private final String uuid; diff --git a/server/sonar-ce/src/main/java/org/sonar/ce/taskprocessor/TimeoutCeTaskInterrupter.java b/server/sonar-ce/src/main/java/org/sonar/ce/taskprocessor/TimeoutCeTaskInterrupter.java index 78589b62ef4..2aca220f539 100644 --- a/server/sonar-ce/src/main/java/org/sonar/ce/taskprocessor/TimeoutCeTaskInterrupter.java +++ b/server/sonar-ce/src/main/java/org/sonar/ce/taskprocessor/TimeoutCeTaskInterrupter.java @@ -22,8 +22,9 @@ package org.sonar.ce.taskprocessor; import java.util.HashMap; import java.util.Map; import java.util.Optional; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.api.utils.System2; -import org.sonar.api.utils.log.Loggers; import org.sonar.ce.task.CeTask; import org.sonar.ce.task.CeTaskInterruptedException; import org.sonar.ce.task.CeTaskTimeoutException; @@ -41,6 +42,7 @@ import static java.lang.String.format; * </ul> */ public class TimeoutCeTaskInterrupter extends SimpleCeTaskInterrupter { + private static final Logger LOG = LoggerFactory.getLogger(TimeoutCeTaskInterrupter.class); private final long taskTimeoutThreshold; private final CeWorkerController ceWorkerController; private final System2 system2; @@ -48,7 +50,7 @@ public class TimeoutCeTaskInterrupter extends SimpleCeTaskInterrupter { public TimeoutCeTaskInterrupter(long taskTimeoutThreshold, CeWorkerController ceWorkerController, System2 system2) { checkArgument(taskTimeoutThreshold >= 1, "threshold must be >= 1"); - Loggers.get(TimeoutCeTaskInterrupter.class).info("Compute Engine Task timeout enabled: {} ms", taskTimeoutThreshold); + LOG.info("Compute Engine Task timeout enabled: {} ms", taskTimeoutThreshold); this.taskTimeoutThreshold = taskTimeoutThreshold; this.ceWorkerController = ceWorkerController; @@ -85,9 +87,11 @@ public class TimeoutCeTaskInterrupter extends SimpleCeTaskInterrupter { long now = system2.now(); Long existingTimestamp = startTimestampByCeTaskUuid.put(ceTask.getUuid(), now); if (existingTimestamp != null) { - Loggers.get(TimeoutCeTaskInterrupter.class) - .warn("Notified of start of execution of task %s but start had already been recorded at %s. Recording new start at %s", - ceTask.getUuid(), existingTimestamp, now); + LOG.warn( + "Notified of start of execution of task {} but start had already been recorded at {}. Recording new start at {}", + ceTask.getUuid(), + existingTimestamp, + now); } } @@ -95,8 +99,7 @@ public class TimeoutCeTaskInterrupter extends SimpleCeTaskInterrupter { public void onEnd(CeTask ceTask) { Long startTimestamp = startTimestampByCeTaskUuid.remove(ceTask.getUuid()); if (startTimestamp == null) { - Loggers.get(TimeoutCeTaskInterrupter.class) - .warn("Notified of end of execution of task %s but start wasn't recorded", ceTask.getUuid()); + LOG.warn("Notified of end of execution of task {} but start wasn't recorded", ceTask.getUuid()); } } diff --git a/server/sonar-db-core/src/it/java/org/sonar/db/DatabaseUtilsIT.java b/server/sonar-db-core/src/it/java/org/sonar/db/DatabaseUtilsIT.java index 91763ab314e..7d532a01d7a 100644 --- a/server/sonar-db-core/src/it/java/org/sonar/db/DatabaseUtilsIT.java +++ b/server/sonar-db-core/src/it/java/org/sonar/db/DatabaseUtilsIT.java @@ -38,7 +38,7 @@ import org.junit.Rule; import org.junit.Test; import org.slf4j.event.Level; import org.sonar.api.testfixtures.log.LogTester; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.LoggerFactory; import org.sonar.core.util.stream.MoreCollectors; import org.sonar.db.dialect.Oracle; @@ -392,7 +392,7 @@ public class DatabaseUtilsIT { SQLException next = new SQLException("this is next", "456"); root.setNextException(next); - log(Loggers.get(getClass()), root); + log(LoggerFactory.getLogger(getClass()), root); assertThat(logTester.logs(Level.ERROR)).contains("SQL error: 456. Message: this is next"); } diff --git a/server/sonar-db-core/src/main/java/org/sonar/db/DatabaseUtils.java b/server/sonar-db-core/src/main/java/org/sonar/db/DatabaseUtils.java index 1a60105fe33..64936983ade 100644 --- a/server/sonar-db-core/src/main/java/org/sonar/db/DatabaseUtils.java +++ b/server/sonar-db-core/src/main/java/org/sonar/db/DatabaseUtils.java @@ -50,8 +50,8 @@ import javax.annotation.CheckForNull; import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.apache.commons.lang.StringUtils; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import static com.google.common.base.Preconditions.checkArgument; import static java.lang.String.format; @@ -76,7 +76,7 @@ public class DatabaseUtils { try { connection.close(); } catch (SQLException e) { - Loggers.get(DatabaseUtils.class).warn("Fail to close connection", e); + LoggerFactory.getLogger(DatabaseUtils.class).warn("Fail to close connection", e); // ignore } } @@ -87,7 +87,7 @@ public class DatabaseUtils { try { stmt.close(); } catch (SQLException e) { - Loggers.get(DatabaseUtils.class).warn("Fail to close statement", e); + LoggerFactory.getLogger(DatabaseUtils.class).warn("Fail to close statement", e); // ignore } } @@ -98,7 +98,7 @@ public class DatabaseUtils { try { rs.close(); } catch (SQLException e) { - Loggers.get(DatabaseUtils.class).warn("Fail to close result set", e); + LoggerFactory.getLogger(DatabaseUtils.class).warn("Fail to close result set", e); // ignore } } @@ -419,7 +419,7 @@ public class DatabaseUtils { try { return connection.getMetaData().getDriverName(); } catch (SQLException e) { - Loggers.get(DatabaseUtils.class).warn("Fail to determine database driver.", e); + LoggerFactory.getLogger(DatabaseUtils.class).warn("Fail to determine database driver.", e); return null; } } @@ -435,7 +435,7 @@ public class DatabaseUtils { schema = connection.getSchema(); } } catch (SQLException e) { - Loggers.get(DatabaseUtils.class).warn("Fail to determine schema. Keeping it null for searching tables", e); + LoggerFactory.getLogger(DatabaseUtils.class).warn("Fail to determine schema. Keeping it null for searching tables", e); } return schema; } diff --git a/server/sonar-db-core/src/main/java/org/sonar/db/DefaultDatabase.java b/server/sonar-db-core/src/main/java/org/sonar/db/DefaultDatabase.java index f11042510c5..27e355543d6 100644 --- a/server/sonar-db-core/src/main/java/org/sonar/db/DefaultDatabase.java +++ b/server/sonar-db-core/src/main/java/org/sonar/db/DefaultDatabase.java @@ -32,8 +32,8 @@ import java.util.Set; import javax.sql.DataSource; import org.apache.commons.lang.StringUtils; import org.sonar.api.config.internal.Settings; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.db.dialect.Dialect; import org.sonar.db.dialect.DialectUtils; import org.sonar.db.profiling.NullConnectionInterceptor; @@ -58,7 +58,7 @@ import static org.sonar.process.ProcessProperties.Property.JDBC_VALIDATION_TIMEO */ public class DefaultDatabase implements Database { private static final String IGNORED_KEYWORDS_OPTION = ";NON_KEYWORDS=VALUE"; - private static final Logger LOG = Loggers.get(Database.class); + private static final Logger LOG = LoggerFactory.getLogger(DefaultDatabase.class); private static final String DEFAULT_URL = "jdbc:h2:tcp://localhost/sonar" + IGNORED_KEYWORDS_OPTION; private static final String SONAR_JDBC = "sonar.jdbc."; diff --git a/server/sonar-db-core/src/main/java/org/sonar/db/dialect/H2.java b/server/sonar-db-core/src/main/java/org/sonar/db/dialect/H2.java index b898cec44c0..3e4d1e852f6 100644 --- a/server/sonar-db-core/src/main/java/org/sonar/db/dialect/H2.java +++ b/server/sonar-db-core/src/main/java/org/sonar/db/dialect/H2.java @@ -21,7 +21,7 @@ package org.sonar.db.dialect; import java.sql.DatabaseMetaData; import org.apache.commons.lang.StringUtils; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.LoggerFactory; public class H2 extends AbstractDialect { @@ -43,6 +43,6 @@ public class H2 extends AbstractDialect { @Override public void init(DatabaseMetaData metaData) { - Loggers.get(getClass()).warn("H2 database should be used for evaluation purpose only."); + LoggerFactory.getLogger(getClass()).warn("H2 database should be used for evaluation purpose only."); } } diff --git a/server/sonar-db-core/src/main/java/org/sonar/db/dialect/PostgreSql.java b/server/sonar-db-core/src/main/java/org/sonar/db/dialect/PostgreSql.java index c38a990c0e3..6cbdb52d68e 100644 --- a/server/sonar-db-core/src/main/java/org/sonar/db/dialect/PostgreSql.java +++ b/server/sonar-db-core/src/main/java/org/sonar/db/dialect/PostgreSql.java @@ -24,7 +24,7 @@ import java.sql.SQLException; import java.util.List; import org.apache.commons.lang.StringUtils; import org.sonar.api.utils.Version; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.LoggerFactory; import static com.google.common.base.Preconditions.checkState; @@ -70,7 +70,7 @@ public class PostgreSql extends AbstractDialect { supportsUpsert = version.compareTo(MIN_UPSERT_VERSION) >= 0; if (!supportsUpsert) { - Loggers.get(getClass()).warn("Upgrading PostgreSQL to {} or greater is recommended for better performances", MIN_UPSERT_VERSION); + LoggerFactory.getLogger(getClass()).warn("Upgrading PostgreSQL to {} or greater is recommended for better performances", MIN_UPSERT_VERSION); } initialized = true; diff --git a/server/sonar-db-core/src/testFixtures/java/org/sonar/db/AbstractDbTester.java b/server/sonar-db-core/src/testFixtures/java/org/sonar/db/AbstractDbTester.java index 7db077d2309..c18d79036aa 100644 --- a/server/sonar-db-core/src/testFixtures/java/org/sonar/db/AbstractDbTester.java +++ b/server/sonar-db-core/src/testFixtures/java/org/sonar/db/AbstractDbTester.java @@ -50,7 +50,7 @@ import org.apache.commons.dbutils.QueryRunner; import org.apache.commons.io.IOUtils; import org.apache.commons.lang.StringUtils; import org.junit.rules.ExternalResource; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.LoggerFactory; import org.sonar.core.util.stream.MoreCollectors; import static com.google.common.base.Preconditions.checkArgument; @@ -516,7 +516,7 @@ public class AbstractDbTester<T extends TestDb> extends ExternalResource { try { this.connection.close(); } catch (SQLException e) { - Loggers.get(CoreDbTester.class).warn("Fail to close connection", e); + LoggerFactory.getLogger(CoreDbTester.class).warn("Fail to close connection", e); // do not re-throw the exception } } diff --git a/server/sonar-db-core/src/testFixtures/java/org/sonar/db/CoreTestDb.java b/server/sonar-db-core/src/testFixtures/java/org/sonar/db/CoreTestDb.java index 148a279a2c4..066c6e16208 100644 --- a/server/sonar-db-core/src/testFixtures/java/org/sonar/db/CoreTestDb.java +++ b/server/sonar-db-core/src/testFixtures/java/org/sonar/db/CoreTestDb.java @@ -32,8 +32,8 @@ import org.apache.commons.codec.digest.DigestUtils; import org.junit.AssumptionViolatedException; import org.sonar.api.config.internal.MapSettings; import org.sonar.api.config.internal.Settings; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.db.version.SqTables; import static java.util.Objects.requireNonNull; @@ -120,7 +120,7 @@ class CoreTestDb implements TestDb { db.start(); databaseInitializer.accept(db); - Loggers.get(getClass()).debug("Test Database: " + db); + LoggerFactory.getLogger(getClass()).debug("Test Database: " + db); String login = settings.getString(JDBC_USERNAME.getKey()); @@ -190,7 +190,7 @@ class CoreTestDb implements TestDb { } private void logJdbcSettings(Settings settings) { - Logger logger = Loggers.get(getClass()); + Logger logger = LoggerFactory.getLogger(getClass()); for (String key : settings.getKeysStartingWith("sonar.jdbc")) { logger.info(key + ": " + settings.getString(key)); } diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/DBSessionsImpl.java b/server/sonar-db-dao/src/main/java/org/sonar/db/DBSessionsImpl.java index d24c4dac4b2..c4713e4c08f 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/DBSessionsImpl.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/DBSessionsImpl.java @@ -24,15 +24,15 @@ import java.util.Objects; import java.util.function.Supplier; import org.apache.ibatis.session.SqlSession; import org.apache.ibatis.session.defaults.DefaultSqlSession; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import static com.google.common.base.Preconditions.checkState; import static java.lang.String.format; import static java.lang.Thread.currentThread; public class DBSessionsImpl implements DBSessions { - private static final Logger LOG = Loggers.get(DBSessionsImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(DBSessionsImpl.class); private static final ThreadLocal<Boolean> CACHING_ENABLED = ThreadLocal.withInitial(() -> Boolean.FALSE); private final ThreadLocal<DelegatingDbSessionSupplier> regularDbSession = ThreadLocal.withInitial(this::buildRegularDbSessionSupplier); diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/property/InternalPropertiesDao.java b/server/sonar-db-dao/src/main/java/org/sonar/db/property/InternalPropertiesDao.java index 173f547fae6..388d1f77d34 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/property/InternalPropertiesDao.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/property/InternalPropertiesDao.java @@ -33,7 +33,7 @@ import java.util.stream.Collectors; import javax.annotation.CheckForNull; import javax.annotation.Nullable; import org.sonar.api.utils.System2; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.LoggerFactory; import org.sonar.db.Dao; import org.sonar.db.DbSession; import org.sonar.db.audit.AuditPersister; @@ -188,7 +188,7 @@ public class InternalPropertiesDao implements Dao { } res = enforceSingleElement(key, mapper.selectAsClob(singletonList(key))); if (res == null) { - Loggers.get(InternalPropertiesDao.class) + LoggerFactory.getLogger(InternalPropertiesDao.class) .debug("Internal property {} has been found in db but has neither text value nor is empty. " + "Still it couldn't be retrieved with clob value. Ignoring the property.", key); return Optional.empty(); diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeDao.java b/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeDao.java index b8524112225..e82d08d5885 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeDao.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeDao.java @@ -29,8 +29,8 @@ import javax.annotation.Nullable; import org.sonar.api.utils.DateUtils; import org.sonar.api.utils.System2; import org.sonar.api.utils.TimeUtils; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.core.util.stream.MoreCollectors; import org.sonar.db.Dao; import org.sonar.db.DbSession; @@ -46,7 +46,7 @@ import static org.sonar.api.utils.DateUtils.dateToLong; import static org.sonar.db.DatabaseUtils.executeLargeInputs; public class PurgeDao implements Dao { - private static final Logger LOG = Loggers.get(PurgeDao.class); + private static final Logger LOG = LoggerFactory.getLogger(PurgeDao.class); private static final Set<String> QUALIFIERS_PROJECT_VIEW = Set.of("TRK", "VW"); private static final Set<String> QUALIFIER_SUBVIEW = Set.of("SVW"); private static final String SCOPE_PROJECT = "PRJ"; diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeProfiler.java b/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeProfiler.java index d392fe30973..4eb9bc1d964 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeProfiler.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeProfiler.java @@ -27,7 +27,7 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; import org.sonar.api.utils.TimeUtils; -import org.sonar.api.utils.log.Logger; +import org.slf4j.Logger; public class PurgeProfiler { diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/purge/period/DefaultPeriodCleaner.java b/server/sonar-db-dao/src/main/java/org/sonar/db/purge/period/DefaultPeriodCleaner.java index 45b2d145431..27de822ddb9 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/purge/period/DefaultPeriodCleaner.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/purge/period/DefaultPeriodCleaner.java @@ -25,8 +25,8 @@ import java.util.List; import java.util.stream.Collectors; import org.sonar.api.config.Configuration; import org.sonar.api.utils.DateUtils; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.core.util.stream.MoreCollectors; import org.sonar.db.DbSession; import org.sonar.db.purge.PurgeDao; @@ -35,7 +35,7 @@ import org.sonar.db.purge.PurgeableAnalysisDto; public class DefaultPeriodCleaner { - private static final Logger LOG = Loggers.get(DefaultPeriodCleaner.class); + private static final Logger LOG = LoggerFactory.getLogger(DefaultPeriodCleaner.class); private final PurgeDao purgeDao; private final PurgeProfiler profiler; diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/purge/period/DeleteAllFilter.java b/server/sonar-db-dao/src/main/java/org/sonar/db/purge/period/DeleteAllFilter.java index 7f6697ecac1..d902d7f4d71 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/purge/period/DeleteAllFilter.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/purge/period/DeleteAllFilter.java @@ -23,7 +23,7 @@ import java.util.ArrayList; import java.util.Date; import java.util.List; import org.sonar.api.utils.DateUtils; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.LoggerFactory; import org.sonar.db.purge.PurgeableAnalysisDto; class DeleteAllFilter implements Filter { @@ -46,6 +46,6 @@ class DeleteAllFilter implements Filter { @Override public void log() { - Loggers.get(getClass()).debug("-> Delete data prior to: {}", DateUtils.formatDate(before)); + LoggerFactory.getLogger(getClass()).debug("-> Delete data prior to: {}", DateUtils.formatDate(before)); } } diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/purge/period/KeepOneFilter.java b/server/sonar-db-dao/src/main/java/org/sonar/db/purge/period/KeepOneFilter.java index 336f21dd4ea..583271e9c8d 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/purge/period/KeepOneFilter.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/purge/period/KeepOneFilter.java @@ -24,7 +24,7 @@ import java.util.ArrayList; import java.util.Date; import java.util.List; import org.sonar.api.utils.DateUtils; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.LoggerFactory; import org.sonar.db.purge.PurgeableAnalysisDto; class KeepOneFilter implements Filter { @@ -54,7 +54,7 @@ class KeepOneFilter implements Filter { @Override public void log() { - Loggers.get(getClass()).debug("-> Keep one snapshot per {} between {} and {}", label, DateUtils.formatDate(start), DateUtils.formatDate(end)); + LoggerFactory.getLogger(getClass()).debug("-> Keep one snapshot per {} between {} and {}", label, DateUtils.formatDate(start), DateUtils.formatDate(end)); } private static void appendSnapshotsToDelete(Interval interval, List<PurgeableAnalysisDto> toDelete) { diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/purge/period/KeepWithVersionFilter.java b/server/sonar-db-dao/src/main/java/org/sonar/db/purge/period/KeepWithVersionFilter.java index 6428c11ceb9..d67686ed4c7 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/purge/period/KeepWithVersionFilter.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/purge/period/KeepWithVersionFilter.java @@ -23,7 +23,7 @@ import com.google.common.base.Strings; import java.util.Date; import java.util.List; import org.sonar.api.utils.DateUtils; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.LoggerFactory; import org.sonar.core.util.stream.MoreCollectors; import org.sonar.db.purge.PurgeableAnalysisDto; @@ -45,7 +45,7 @@ class KeepWithVersionFilter implements Filter { @Override public void log() { - Loggers.get(getClass()).debug("-> Keep analyses with a version prior to {}", DateUtils.formatDate(before)); + LoggerFactory.getLogger(getClass()).debug("-> Keep analyses with a version prior to {}", DateUtils.formatDate(before)); } private static boolean isDeletable(PurgeableAnalysisDto snapshot) { diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/createdb/CreateDb.java b/server/sonar-db-dao/src/test/java/org/sonar/db/createdb/CreateDb.java index c83c5033e7b..69701ca7595 100644 --- a/server/sonar-db-dao/src/test/java/org/sonar/db/createdb/CreateDb.java +++ b/server/sonar-db-dao/src/test/java/org/sonar/db/createdb/CreateDb.java @@ -26,8 +26,8 @@ import com.sonar.orchestrator.db.DefaultDatabase; import java.util.function.Consumer; import org.sonar.api.config.internal.MapSettings; import org.sonar.api.config.internal.Settings; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.db.SQDatabase; public class CreateDb { @@ -60,7 +60,7 @@ public class CreateDb { } private static void logJdbcSettings(Settings settings) { - Logger logger = Loggers.get(CreateDb.class); + Logger logger = LoggerFactory.getLogger(CreateDb.class); for (String key : settings.getKeysStartingWith("sonar.jdbc")) { logger.info(key + ": " + settings.getString(key)); } diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeProfilerTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeProfilerTest.java index 756dfeb11e8..44aa4c7db59 100644 --- a/server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeProfilerTest.java +++ b/server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeProfilerTest.java @@ -21,7 +21,7 @@ package org.sonar.db.purge; import org.junit.Before; import org.junit.Test; -import org.sonar.api.utils.log.Logger; +import org.slf4j.Logger; import static org.mockito.ArgumentMatchers.contains; import static org.mockito.Mockito.mock; diff --git a/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/SQDatabase.java b/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/SQDatabase.java index 5740cc903fc..4a3485c6c06 100644 --- a/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/SQDatabase.java +++ b/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/SQDatabase.java @@ -31,7 +31,7 @@ import org.sonar.api.config.internal.MapSettings; import org.sonar.api.config.internal.Settings; import org.sonar.api.utils.System2; import org.sonar.api.utils.Version; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.LoggerFactory; import org.sonar.core.platform.Container; import org.sonar.core.platform.SonarQubeVersion; import org.sonar.core.platform.SpringComponentContainer; @@ -120,7 +120,7 @@ public class SQDatabase extends DefaultDatabase { } private void execute(RegisteredMigrationStep step, MigrationStep migrationStep) { - Profiler stepProfiler = Profiler.create(Loggers.get(SQDatabase.class)); + Profiler stepProfiler = Profiler.create(LoggerFactory.getLogger(SQDatabase.class)); stepProfiler.startInfo(STEP_START_PATTERN, step); boolean done = false; try { diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/charset/MssqlCharsetHandler.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/charset/MssqlCharsetHandler.java index 2e5ad96bb3f..e58a71ef25d 100644 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/charset/MssqlCharsetHandler.java +++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/charset/MssqlCharsetHandler.java @@ -25,15 +25,15 @@ import java.sql.ResultSet; import java.sql.SQLException; import java.util.List; import org.sonar.api.utils.MessageException; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import static java.lang.String.format; import static org.apache.commons.lang.StringUtils.containsIgnoreCase; class MssqlCharsetHandler extends CharsetHandler { - private static final Logger LOGGER = Loggers.get(MssqlCharsetHandler.class); + private static final Logger LOGGER = LoggerFactory.getLogger(MssqlCharsetHandler.class); private static final String CASE_SENSITIVE_ACCENT_SENSITIVE = "_CS_AS"; private static final String CASE_INSENSITIVE_ACCENT_INSENSITIVE = "_CI_AI"; private static final String CASE_INSENSITIVE_ACCENT_SENSITIVE = "_CI_AS"; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/charset/OracleCharsetHandler.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/charset/OracleCharsetHandler.java index 20d7124c0fc..b7e4094903a 100644 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/charset/OracleCharsetHandler.java +++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/charset/OracleCharsetHandler.java @@ -22,7 +22,7 @@ package org.sonar.server.platform.db.migration.charset; import java.sql.Connection; import java.sql.SQLException; import org.sonar.api.utils.MessageException; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.LoggerFactory; import static java.lang.String.format; import static org.apache.commons.lang.StringUtils.containsIgnoreCase; @@ -41,7 +41,7 @@ class OracleCharsetHandler extends CharsetHandler { // any errors related to charset if they didn't follow the UTF8 requirement when creating // the schema in previous SonarQube versions. if (state == DatabaseCharsetChecker.State.FRESH_INSTALL) { - Loggers.get(getClass()).info("Verify that database charset is UTF8"); + LoggerFactory.getLogger(getClass()).info("Verify that database charset is UTF8"); expectUtf8(connection); } } diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/charset/PostgresCharsetHandler.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/charset/PostgresCharsetHandler.java index 1ca2e6e92ac..522a059e625 100644 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/charset/PostgresCharsetHandler.java +++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/charset/PostgresCharsetHandler.java @@ -28,7 +28,7 @@ import java.util.List; import java.util.Set; import java.util.stream.Collectors; import org.sonar.api.utils.MessageException; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.LoggerFactory; import org.sonar.db.version.SqTables; import static java.lang.String.format; @@ -58,7 +58,7 @@ class PostgresCharsetHandler extends CharsetHandler { } private void expectUtf8AsDefault(Connection connection) throws SQLException { - Loggers.get(getClass()).info("Verify that database charset supports UTF8"); + LoggerFactory.getLogger(getClass()).info("Verify that database charset supports UTF8"); String collation = metadata.getDefaultCharset(connection); if (!containsIgnoreCase(collation, UTF8)) { throw MessageException.of(format("Database charset is %s. It must support UTF8.", collation)); diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/history/MigrationHistoryTableImpl.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/history/MigrationHistoryTableImpl.java index 5d05fbcca11..64bdf944041 100644 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/history/MigrationHistoryTableImpl.java +++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/history/MigrationHistoryTableImpl.java @@ -23,7 +23,7 @@ import java.sql.Connection; import java.sql.SQLException; import java.sql.Statement; import java.util.List; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.LoggerFactory; import org.sonar.db.Database; import org.sonar.db.DatabaseUtils; import org.sonar.server.platform.db.migration.def.VarcharColumnDef; @@ -54,7 +54,7 @@ public class MigrationHistoryTableImpl implements MigrationHistoryTable { .addColumn(VarcharColumnDef.newVarcharColumnDefBuilder().setColumnName(VERSION_COLUMN_NAME).setIsNullable(false).setLimit(255).build()) .build(); - Loggers.get(MigrationHistoryTableImpl.class).info("Creating table " + NAME); + LoggerFactory.getLogger(MigrationHistoryTableImpl.class).info("Creating table " + NAME); for (String sql : sqls) { execute(connection, sql); } diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/step/MigrationStepsExecutorImpl.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/step/MigrationStepsExecutorImpl.java index 7c692360d10..fbbdbdf8c26 100644 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/step/MigrationStepsExecutorImpl.java +++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/step/MigrationStepsExecutorImpl.java @@ -20,8 +20,8 @@ package org.sonar.server.platform.db.migration.step; import java.util.List; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.core.platform.Container; import org.sonar.core.util.logs.Profiler; import org.sonar.server.platform.db.migration.history.MigrationHistory; @@ -29,7 +29,7 @@ import org.sonar.server.platform.db.migration.history.MigrationHistory; import static com.google.common.base.Preconditions.checkState; public class MigrationStepsExecutorImpl implements MigrationStepsExecutor { - private static final Logger LOGGER = Loggers.get("DbMigrations"); + private static final Logger LOGGER = LoggerFactory.getLogger("DbMigrations"); private static final String GLOBAL_START_MESSAGE = "Executing DB migrations..."; private static final String GLOBAL_END_MESSAGE = "Executed DB migrations: {}"; private static final String STEP_START_PATTERN = "{}..."; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v100/LogMessageIfSonarScimEnabledPresentProperty.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v100/LogMessageIfSonarScimEnabledPresentProperty.java index 58a3ba3e6a7..c6ce70da1c3 100644 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v100/LogMessageIfSonarScimEnabledPresentProperty.java +++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v100/LogMessageIfSonarScimEnabledPresentProperty.java @@ -20,14 +20,14 @@ package org.sonar.server.platform.db.migration.version.v100; import java.sql.SQLException; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.db.Database; import org.sonar.server.platform.db.migration.step.DataChange; public class LogMessageIfSonarScimEnabledPresentProperty extends DataChange { - private static final Logger LOG = Loggers.get(LogMessageIfSonarScimEnabledPresentProperty.class); + private static final Logger LOG = LoggerFactory.getLogger(LogMessageIfSonarScimEnabledPresentProperty.class); public static final String SONAR_SCIM_ENABLED = "sonar.scim.enabled"; private static final String SCIM_DOC_URL = "https://docs.sonarqube.org/10.1/instance-administration/authentication/saml/scim/overview/"; diff --git a/server/sonar-process/src/main/java/org/sonar/process/FileUtils2.java b/server/sonar-process/src/main/java/org/sonar/process/FileUtils2.java index 7d8085d6380..31fbc41df1a 100644 --- a/server/sonar-process/src/main/java/org/sonar/process/FileUtils2.java +++ b/server/sonar-process/src/main/java/org/sonar/process/FileUtils2.java @@ -31,8 +31,8 @@ import java.nio.file.SimpleFileVisitor; import java.nio.file.attribute.BasicFileAttributes; import java.util.EnumSet; import javax.annotation.Nullable; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import static java.lang.String.format; import static java.util.Objects.requireNonNull; @@ -42,7 +42,7 @@ import static java.util.Objects.requireNonNull; * {@link org.apache.commons.io.FileUtils Common IO FileUtils} class. */ public final class FileUtils2 { - private static final Logger LOG = Loggers.get(FileUtils2.class); + private static final Logger LOG = LoggerFactory.getLogger(FileUtils2.class); private static final String DIRECTORY_CAN_NOT_BE_NULL = "Directory can not be null"; private static final EnumSet<FileVisitOption> FOLLOW_LINKS = EnumSet.of(FileVisitOption.FOLLOW_LINKS); diff --git a/server/sonar-process/src/main/java/org/sonar/process/NetworkUtilsImpl.java b/server/sonar-process/src/main/java/org/sonar/process/NetworkUtilsImpl.java index 0baa8bb2dc5..15a37fbe8f3 100644 --- a/server/sonar-process/src/main/java/org/sonar/process/NetworkUtilsImpl.java +++ b/server/sonar-process/src/main/java/org/sonar/process/NetworkUtilsImpl.java @@ -33,8 +33,8 @@ import java.util.Optional; import java.util.OptionalInt; import java.util.Set; import java.util.function.Predicate; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import static java.lang.String.format; @@ -42,7 +42,7 @@ public class NetworkUtilsImpl implements NetworkUtils { private static final Set<Integer> PORTS_ALREADY_ALLOCATED = new HashSet<>(); private static final int PORT_MAX_TRIES = 50; - private static final Logger LOG = Loggers.get(NetworkUtilsImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(NetworkUtilsImpl.class); public static final NetworkUtils INSTANCE = new NetworkUtilsImpl(); diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/async/AsyncExecutionExecutorServiceImpl.java b/server/sonar-server-common/src/main/java/org/sonar/server/async/AsyncExecutionExecutorServiceImpl.java index aa7c9c98f15..f0ecf135164 100644 --- a/server/sonar-server-common/src/main/java/org/sonar/server/async/AsyncExecutionExecutorServiceImpl.java +++ b/server/sonar-server-common/src/main/java/org/sonar/server/async/AsyncExecutionExecutorServiceImpl.java @@ -22,8 +22,8 @@ package org.sonar.server.async; import com.google.common.util.concurrent.ThreadFactoryBuilder; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ThreadPoolExecutor; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.server.util.AbstractStoppableExecutorService; import static java.util.concurrent.TimeUnit.MINUTES; @@ -31,7 +31,7 @@ import static java.util.concurrent.TimeUnit.MINUTES; public class AsyncExecutionExecutorServiceImpl extends AbstractStoppableExecutorService<ThreadPoolExecutor> implements AsyncExecutionExecutorService, AsyncExecutionMonitoring { - private static final Logger LOG = Loggers.get(AsyncExecutionExecutorServiceImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(AsyncExecutionExecutorServiceImpl.class); private static final int MAX_THREAD_COUNT = 10; private static final int UNLIMITED_QUEUE = Integer.MAX_VALUE; diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/async/AsyncExecutionImpl.java b/server/sonar-server-common/src/main/java/org/sonar/server/async/AsyncExecutionImpl.java index 7d97eb3611a..e7ccceeec69 100644 --- a/server/sonar-server-common/src/main/java/org/sonar/server/async/AsyncExecutionImpl.java +++ b/server/sonar-server-common/src/main/java/org/sonar/server/async/AsyncExecutionImpl.java @@ -19,13 +19,13 @@ */ package org.sonar.server.async; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import static java.util.Objects.requireNonNull; public class AsyncExecutionImpl implements AsyncExecution { - private static final Logger LOG = Loggers.get(AsyncExecutionImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(AsyncExecutionImpl.class); private final AsyncExecutionExecutorService executorService; public AsyncExecutionImpl(AsyncExecutionExecutorService executorService) { diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/es/BulkIndexer.java b/server/sonar-server-common/src/main/java/org/sonar/server/es/BulkIndexer.java index 5210f541e58..a0cf640e790 100644 --- a/server/sonar-server-common/src/main/java/org/sonar/server/es/BulkIndexer.java +++ b/server/sonar-server-common/src/main/java/org/sonar/server/es/BulkIndexer.java @@ -55,8 +55,8 @@ import org.elasticsearch.common.unit.ByteSizeValue; import org.elasticsearch.core.TimeValue; import org.elasticsearch.search.SearchHit; import org.elasticsearch.search.sort.SortOrder; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.api.utils.log.Profiler; import org.sonar.core.util.ProgressLogger; @@ -71,7 +71,7 @@ import static java.lang.String.format; */ public class BulkIndexer { - private static final Logger LOGGER = Loggers.get(BulkIndexer.class); + private static final Logger LOGGER = LoggerFactory.getLogger(BulkIndexer.class); private static final ByteSizeValue FLUSH_BYTE_SIZE = new ByteSizeValue(1, ByteSizeUnit.MB); private static final int FLUSH_ACTIONS = -1; private static final String REFRESH_INTERVAL_SETTING = "index.refresh_interval"; diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/es/EsClientProvider.java b/server/sonar-server-common/src/main/java/org/sonar/server/es/EsClientProvider.java index 47427d9dde1..fdb52994314 100644 --- a/server/sonar-server-common/src/main/java/org/sonar/server/es/EsClientProvider.java +++ b/server/sonar-server-common/src/main/java/org/sonar/server/es/EsClientProvider.java @@ -31,8 +31,8 @@ import org.elasticsearch.common.settings.Settings; import org.sonar.api.ce.ComputeEngineSide; import org.sonar.api.config.Configuration; import org.sonar.api.server.ServerSide; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.process.cluster.NodeType; import org.springframework.context.annotation.Bean; @@ -48,7 +48,7 @@ import static org.sonar.process.cluster.NodeType.SEARCH; @ComputeEngineSide @ServerSide public class EsClientProvider { - private static final Logger LOGGER = Loggers.get(EsClientProvider.class); + private static final Logger LOGGER = LoggerFactory.getLogger(EsClientProvider.class); @Bean("EsClient") public EsClient provide(Configuration config) { diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/issue/index/IssueIndexer.java b/server/sonar-server-common/src/main/java/org/sonar/server/issue/index/IssueIndexer.java index c8b477e955d..4f0c41073ff 100644 --- a/server/sonar-server-common/src/main/java/org/sonar/server/issue/index/IssueIndexer.java +++ b/server/sonar-server-common/src/main/java/org/sonar/server/issue/index/IssueIndexer.java @@ -30,8 +30,8 @@ import org.elasticsearch.action.index.IndexRequest; import org.elasticsearch.action.search.SearchRequest; import org.elasticsearch.search.builder.SearchSourceBuilder; import org.sonar.api.resources.Qualifiers; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.core.util.stream.MoreCollectors; import org.sonar.db.DbClient; import org.sonar.db.DbSession; @@ -66,7 +66,7 @@ public class IssueIndexer implements ProjectIndexer, NeedAuthorizationIndexer { * Indicates that es_queue.doc_id references a project. All the issues of the project must be indexed. */ private static final String ID_TYPE_PROJECT_UUID = "projectUuid"; - private static final Logger LOGGER = Loggers.get(IssueIndexer.class); + private static final Logger LOGGER = LoggerFactory.getLogger(IssueIndexer.class); private static final AuthorizationScope AUTHORIZATION_SCOPE = new AuthorizationScope(TYPE_ISSUE, project -> Qualifiers.PROJECT.equals(project.getQualifier())); private static final Set<IndexType> INDEX_TYPES = Set.of(TYPE_ISSUE); diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/notification/DefaultNotificationManager.java b/server/sonar-server-common/src/main/java/org/sonar/server/notification/DefaultNotificationManager.java index 641c30a26ee..65135dc393e 100644 --- a/server/sonar-server-common/src/main/java/org/sonar/server/notification/DefaultNotificationManager.java +++ b/server/sonar-server-common/src/main/java/org/sonar/server/notification/DefaultNotificationManager.java @@ -31,8 +31,8 @@ import javax.annotation.Nullable; import org.sonar.api.notifications.Notification; import org.sonar.api.notifications.NotificationChannel; import org.sonar.api.utils.SonarException; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.core.util.stream.MoreCollectors; import org.sonar.db.DbClient; import org.sonar.db.DbSession; @@ -46,7 +46,7 @@ import static java.util.Objects.requireNonNull; public class DefaultNotificationManager implements NotificationManager { - private static final Logger LOG = Loggers.get(DefaultNotificationManager.class); + private static final Logger LOG = LoggerFactory.getLogger(DefaultNotificationManager.class); private static final String UNABLE_TO_READ_NOTIFICATION = "Unable to read notification"; diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/notification/NotificationService.java b/server/sonar-server-common/src/main/java/org/sonar/server/notification/NotificationService.java index 6f83e714f36..c85cf7f0bb8 100644 --- a/server/sonar-server-common/src/main/java/org/sonar/server/notification/NotificationService.java +++ b/server/sonar-server-common/src/main/java/org/sonar/server/notification/NotificationService.java @@ -35,8 +35,8 @@ import org.sonar.api.ce.ComputeEngineSide; import org.sonar.api.notifications.Notification; import org.sonar.api.notifications.NotificationChannel; import org.sonar.api.server.ServerSide; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.core.util.stream.MoreCollectors; import org.sonar.db.DbClient; import org.springframework.beans.factory.annotation.Autowired; @@ -47,7 +47,7 @@ import static com.google.common.base.Preconditions.checkArgument; @ComputeEngineSide public class NotificationService { - private static final Logger LOG = Loggers.get(NotificationService.class); + private static final Logger LOG = LoggerFactory.getLogger(NotificationService.class); private final List<NotificationDispatcher> dispatchers; private final List<NotificationHandler<? extends Notification>> handlers; diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/notification/email/EmailNotificationChannel.java b/server/sonar-server-common/src/main/java/org/sonar/server/notification/email/EmailNotificationChannel.java index 5e9f60b5668..4181eada966 100644 --- a/server/sonar-server-common/src/main/java/org/sonar/server/notification/email/EmailNotificationChannel.java +++ b/server/sonar-server-common/src/main/java/org/sonar/server/notification/email/EmailNotificationChannel.java @@ -34,8 +34,8 @@ import org.sonar.api.notifications.Notification; import org.sonar.api.notifications.NotificationChannel; import org.sonar.api.user.User; import org.sonar.api.utils.SonarException; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.db.user.UserDto; @@ -56,7 +56,7 @@ import static java.util.Objects.requireNonNull; */ public class EmailNotificationChannel extends NotificationChannel { - private static final Logger LOG = Loggers.get(EmailNotificationChannel.class); + private static final Logger LOG = LoggerFactory.getLogger(EmailNotificationChannel.class); /** * @see org.apache.commons.mail.Email#setSocketConnectionTimeout(int) diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/platform/DefaultNodeInformation.java b/server/sonar-server-common/src/main/java/org/sonar/server/platform/DefaultNodeInformation.java index 664d242e8b1..49e16f8f7e4 100644 --- a/server/sonar-server-common/src/main/java/org/sonar/server/platform/DefaultNodeInformation.java +++ b/server/sonar-server-common/src/main/java/org/sonar/server/platform/DefaultNodeInformation.java @@ -21,7 +21,7 @@ package org.sonar.server.platform; import java.util.Optional; import org.sonar.api.config.Configuration; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.LoggerFactory; import static org.sonar.process.ProcessProperties.Property.CLUSTER_ENABLED; import static org.sonar.process.ProcessProperties.Property.CLUSTER_NODE_NAME; @@ -38,7 +38,7 @@ public class DefaultNodeInformation implements NodeInformation { if (this.clusterEnabled) { this.startupLeader = config.getBoolean(CLUSTER_WEB_STARTUP_LEADER.getKey()).orElse(false); this.nodeName = config.get(CLUSTER_NODE_NAME.getKey()).orElse(CLUSTER_NODE_NAME.getDefaultValue()); - Loggers.get(DefaultNodeInformation.class).info("Cluster enabled (startup {})", startupLeader ? "leader" : "follower"); + LoggerFactory.getLogger(DefaultNodeInformation.class).info("Cluster enabled (startup {})", startupLeader ? "leader" : "follower"); } else { this.startupLeader = true; this.nodeName = null; diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/platform/ServerFileSystemImpl.java b/server/sonar-server-common/src/main/java/org/sonar/server/platform/ServerFileSystemImpl.java index 54737c48e5a..20dc145d5d2 100644 --- a/server/sonar-server-common/src/main/java/org/sonar/server/platform/ServerFileSystemImpl.java +++ b/server/sonar-server-common/src/main/java/org/sonar/server/platform/ServerFileSystemImpl.java @@ -24,8 +24,8 @@ import java.io.IOException; import org.apache.commons.io.FileUtils; import org.sonar.api.Startable; import org.sonar.api.config.Configuration; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import static org.sonar.process.ProcessProperties.Property.PATH_DATA; import static org.sonar.process.ProcessProperties.Property.PATH_HOME; @@ -33,7 +33,7 @@ import static org.sonar.process.ProcessProperties.Property.PATH_TEMP; public class ServerFileSystemImpl implements ServerFileSystem, org.sonar.api.platform.ServerFileSystem, Startable { - private static final Logger LOGGER = Loggers.get(ServerFileSystemImpl.class); + private static final Logger LOGGER = LoggerFactory.getLogger(ServerFileSystemImpl.class); private final File homeDir; private final File tempDir; diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/platform/ServerLifecycleNotifier.java b/server/sonar-server-common/src/main/java/org/sonar/server/platform/ServerLifecycleNotifier.java index 68fe2c2e0ce..e895ecb7b14 100644 --- a/server/sonar-server-common/src/main/java/org/sonar/server/platform/ServerLifecycleNotifier.java +++ b/server/sonar-server-common/src/main/java/org/sonar/server/platform/ServerLifecycleNotifier.java @@ -20,38 +20,41 @@ package org.sonar.server.platform; import javax.annotation.Nullable; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.api.Startable; import org.sonar.api.platform.Server; import org.sonar.api.platform.ServerStartHandler; import org.sonar.api.platform.ServerStopHandler; -import org.sonar.api.utils.log.Loggers; /** * @since 2.2 */ public class ServerLifecycleNotifier implements Startable { + private static final Logger LOG = LoggerFactory.getLogger(ServerLifecycleNotifier.class); private final ServerStartHandler[] startHandlers; private final ServerStopHandler[] stopHandlers; private final Server server; public ServerLifecycleNotifier(Server server, @Nullable ServerStartHandler[] startHandlers, @Nullable ServerStopHandler[] stopHandlers) { - this.startHandlers = startHandlers != null ? startHandlers : new ServerStartHandler[0]; - this.stopHandlers = stopHandlers != null ? stopHandlers: new ServerStopHandler[0]; + this.startHandlers = startHandlers != null ? startHandlers : new ServerStartHandler[0]; + this.stopHandlers = stopHandlers != null ? stopHandlers : new ServerStopHandler[0]; this.server = server; } @Override public void start() { - /* IMPORTANT : - we want to be sure that handlers are notified when all other services are started. - That's why the class Platform explicitely executes the method notifyStart(), instead of letting the ioc container - choose the startup order. + /* + * IMPORTANT : + * we want to be sure that handlers are notified when all other services are started. + * That's why the class Platform explicitely executes the method notifyStart(), instead of letting the ioc container + * choose the startup order. */ } public void notifyStart() { - Loggers.get(ServerLifecycleNotifier.class).debug("Notify " + ServerStartHandler.class.getSimpleName() + " handlers..."); + LOG.debug("Notify {} handlers...", ServerStartHandler.class.getSimpleName()); for (ServerStartHandler handler : startHandlers) { handler.onServerStart(server); } @@ -59,7 +62,7 @@ public class ServerLifecycleNotifier implements Startable { @Override public void stop() { - Loggers.get(ServerLifecycleNotifier.class).debug("Notify " + ServerStopHandler.class.getSimpleName() + " handlers..."); + LOG.debug("Notify {} handlers...", ServerStopHandler.class.getSimpleName()); for (ServerStopHandler handler : stopHandlers) { handler.onServerStop(server); } diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/plugins/PluginRequirementsValidator.java b/server/sonar-server-common/src/main/java/org/sonar/server/plugins/PluginRequirementsValidator.java index 647fb721496..11381c1aabe 100644 --- a/server/sonar-server-common/src/main/java/org/sonar/server/plugins/PluginRequirementsValidator.java +++ b/server/sonar-server-common/src/main/java/org/sonar/server/plugins/PluginRequirementsValidator.java @@ -23,8 +23,8 @@ import com.google.common.base.Strings; import java.util.HashSet; import java.util.Map; import java.util.Set; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.core.platform.PluginInfo; import org.sonar.updatecenter.common.Version; @@ -33,7 +33,7 @@ import org.sonar.updatecenter.common.Version; * @param <T> */ public class PluginRequirementsValidator<T extends PluginInfo> { - private static final Logger LOG = Loggers.get(PluginRequirementsValidator.class); + private static final Logger LOG = LoggerFactory.getLogger(PluginRequirementsValidator.class); private final Map<String, T> allPluginsByKeys; diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/qualityprofile/index/ActiveRuleIndexer.java b/server/sonar-server-common/src/main/java/org/sonar/server/qualityprofile/index/ActiveRuleIndexer.java index 5a7fe81124c..1770ec7c2e8 100644 --- a/server/sonar-server-common/src/main/java/org/sonar/server/qualityprofile/index/ActiveRuleIndexer.java +++ b/server/sonar-server-common/src/main/java/org/sonar/server/qualityprofile/index/ActiveRuleIndexer.java @@ -30,8 +30,8 @@ import org.elasticsearch.action.index.IndexRequest; import org.elasticsearch.action.search.SearchRequest; import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.search.builder.SearchSourceBuilder; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.db.es.EsQueueDto; @@ -59,7 +59,7 @@ import static org.sonar.server.rule.index.RuleIndexDefinition.TYPE_ACTIVE_RULE; public class ActiveRuleIndexer implements ResilientIndexer { - private static final Logger LOGGER = Loggers.get(ActiveRuleIndexer.class); + private static final Logger LOGGER = LoggerFactory.getLogger(ActiveRuleIndexer.class); private static final String ID_TYPE_ACTIVE_RULE_UUID = "activeRuleUuid"; private static final String ID_TYPE_RULE_PROFILE_UUID = "ruleProfileUuid"; diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/rule/index/RuleIndexer.java b/server/sonar-server-common/src/main/java/org/sonar/server/rule/index/RuleIndexer.java index 9f01529078d..dcb59a115ad 100644 --- a/server/sonar-server-common/src/main/java/org/sonar/server/rule/index/RuleIndexer.java +++ b/server/sonar-server-common/src/main/java/org/sonar/server/rule/index/RuleIndexer.java @@ -26,8 +26,8 @@ import java.util.List; import java.util.Optional; import java.util.Set; import java.util.stream.Stream; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.core.util.stream.MoreCollectors; import org.sonar.db.DbClient; import org.sonar.db.DbSession; @@ -51,7 +51,7 @@ import static org.sonar.server.rule.index.RuleIndexDefinition.TYPE_RULE; import static org.sonar.server.security.SecurityStandards.SQ_CATEGORY_KEYS_ORDERING; public class RuleIndexer implements ResilientIndexer { - private static final Logger LOG = Loggers.get(RuleIndexer.class); + private static final Logger LOG = LoggerFactory.getLogger(RuleIndexer.class); private final EsClient esClient; private final DbClient dbClient; diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/util/AbstractStoppableExecutorService.java b/server/sonar-server-common/src/main/java/org/sonar/server/util/AbstractStoppableExecutorService.java index 0c1b5e299c9..f0e91132e05 100644 --- a/server/sonar-server-common/src/main/java/org/sonar/server/util/AbstractStoppableExecutorService.java +++ b/server/sonar-server-common/src/main/java/org/sonar/server/util/AbstractStoppableExecutorService.java @@ -19,7 +19,7 @@ */ package org.sonar.server.util; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.LoggerFactory; import java.util.Collection; import java.util.List; @@ -54,11 +54,11 @@ public abstract class AbstractStoppableExecutorService<D extends ExecutorService delegate.shutdownNow(); // Wait a while for tasks to respond to being canceled if (!delegate.awaitTermination(5, TimeUnit.SECONDS)) { - Loggers.get(getClass()).warn(format("Pool %s did not terminate", getClass().getSimpleName())); + LoggerFactory.getLogger(getClass()).warn(format("Pool %s did not terminate", getClass().getSimpleName())); } } } catch (InterruptedException ie) { - Loggers.get(getClass()).warn(format("Termination of pool %s failed", getClass().getSimpleName()), ie); + LoggerFactory.getLogger(getClass()).warn(format("Termination of pool %s failed", getClass().getSimpleName()), ie); // (Re-)Cancel if current thread also interrupted delegate.shutdownNow(); } diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/webhook/WebHooksImpl.java b/server/sonar-server-common/src/main/java/org/sonar/server/webhook/WebHooksImpl.java index 4a8239802b2..b62a495ad97 100644 --- a/server/sonar-server-common/src/main/java/org/sonar/server/webhook/WebHooksImpl.java +++ b/server/sonar-server-common/src/main/java/org/sonar/server/webhook/WebHooksImpl.java @@ -28,8 +28,8 @@ import javax.annotation.Nullable; import org.sonar.api.ce.ComputeEngineSide; import org.sonar.api.ce.posttask.PostProjectAnalysisTask; import org.sonar.api.server.ServerSide; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.core.util.stream.MoreCollectors; import org.sonar.db.DbClient; import org.sonar.db.DbSession; @@ -44,7 +44,7 @@ import static java.lang.String.format; @ComputeEngineSide public class WebHooksImpl implements WebHooks { - private static final Logger LOGGER = Loggers.get(WebHooksImpl.class); + private static final Logger LOGGER = LoggerFactory.getLogger(WebHooksImpl.class); private final WebhookCaller caller; private final WebhookDeliveryStorage deliveryStorage; diff --git a/server/sonar-server-common/src/testFixtures/java/org/sonar/server/es/EsTester.java b/server/sonar-server-common/src/testFixtures/java/org/sonar/server/es/EsTester.java index ca3cbb50ca8..460b2d47200 100644 --- a/server/sonar-server-common/src/testFixtures/java/org/sonar/server/es/EsTester.java +++ b/server/sonar-server-common/src/testFixtures/java/org/sonar/server/es/EsTester.java @@ -86,8 +86,8 @@ import org.elasticsearch.search.builder.SearchSourceBuilder; import org.elasticsearch.search.sort.SortOrder; import org.elasticsearch.transport.Netty4Plugin; import org.junit.rules.ExternalResource; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.server.component.index.ComponentIndexDefinition; import org.sonar.server.es.IndexDefinition.IndexDefinitionContext; import org.sonar.server.es.IndexType.IndexRelationType; @@ -114,7 +114,7 @@ public class EsTester extends ExternalResource { private static final int MIN_PORT = 1; private static final int MAX_PORT = 49151; private static final int MIN_NON_ROOT_PORT = 1025; - private static final Logger LOG = Loggers.get(EsTester.class); + private static final Logger LOG = LoggerFactory.getLogger(EsTester.class); static { System.setProperty("log4j.shutdownHookEnabled", "false"); diff --git a/server/sonar-webserver-api/src/main/java/org/sonar/server/plugins/PluginConsentVerifier.java b/server/sonar-webserver-api/src/main/java/org/sonar/server/plugins/PluginConsentVerifier.java index c4960ff3fd1..5803763886b 100644 --- a/server/sonar-webserver-api/src/main/java/org/sonar/server/plugins/PluginConsentVerifier.java +++ b/server/sonar-webserver-api/src/main/java/org/sonar/server/plugins/PluginConsentVerifier.java @@ -22,8 +22,8 @@ package org.sonar.server.plugins; import java.util.Optional; import org.sonar.api.Startable; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.core.extension.PluginRiskConsent; import org.sonar.core.plugin.PluginType; import org.sonar.db.DbClient; @@ -36,7 +36,7 @@ import static org.sonar.core.extension.PluginRiskConsent.REQUIRED; import static org.sonar.server.log.ServerProcessLogging.STARTUP_LOGGER_NAME; public class PluginConsentVerifier implements Startable { - private static final Logger LOGGER = Loggers.get(STARTUP_LOGGER_NAME); + private static final Logger LOGGER = LoggerFactory.getLogger(STARTUP_LOGGER_NAME); private final ServerPluginRepository pluginRepository; private final DbClient dbClient; diff --git a/server/sonar-webserver-api/src/main/java/org/sonar/server/plugins/PluginDownloader.java b/server/sonar-webserver-api/src/main/java/org/sonar/server/plugins/PluginDownloader.java index bb4220f3f7e..cb35d124d5a 100644 --- a/server/sonar-webserver-api/src/main/java/org/sonar/server/plugins/PluginDownloader.java +++ b/server/sonar-webserver-api/src/main/java/org/sonar/server/plugins/PluginDownloader.java @@ -30,8 +30,8 @@ import java.util.Optional; import org.apache.commons.io.FileUtils; import org.sonar.api.Startable; import org.sonar.api.utils.HttpDownloader; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.core.platform.PluginInfo; import org.sonar.core.util.stream.MoreCollectors; import org.sonar.server.platform.ServerFileSystem; @@ -53,7 +53,7 @@ import static org.sonar.server.exceptions.BadRequestException.checkRequest; */ public class PluginDownloader implements Startable { - private static final Logger LOG = Loggers.get(PluginDownloader.class); + private static final Logger LOG = LoggerFactory.getLogger(PluginDownloader.class); private static final String TMP_SUFFIX = "tmp"; private static final String PLUGIN_EXTENSION = "jar"; diff --git a/server/sonar-webserver-api/src/main/java/org/sonar/server/plugins/PluginJarLoader.java b/server/sonar-webserver-api/src/main/java/org/sonar/server/plugins/PluginJarLoader.java index 34b653d9a69..6f272ee6316 100644 --- a/server/sonar-webserver-api/src/main/java/org/sonar/server/plugins/PluginJarLoader.java +++ b/server/sonar-webserver-api/src/main/java/org/sonar/server/plugins/PluginJarLoader.java @@ -33,10 +33,10 @@ import java.util.Set; import java.util.function.Function; import javax.inject.Inject; import org.apache.commons.io.FileUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.api.SonarRuntime; import org.sonar.api.utils.MessageException; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; import org.sonar.core.platform.PluginInfo; import org.sonar.server.platform.ServerFileSystem; @@ -48,7 +48,8 @@ import static org.sonar.core.util.FileUtils.deleteQuietly; import static org.sonar.server.log.ServerProcessLogging.STARTUP_LOGGER_NAME; public class PluginJarLoader { - private static final Logger LOG = Loggers.get(PluginJarLoader.class); + private static final Logger STARTUP_LOGGER = LoggerFactory.getLogger(STARTUP_LOGGER_NAME); + private static final Logger LOG = LoggerFactory.getLogger(PluginJarLoader.class); // List of plugins that are silently removed if installed private static final Set<String> DEFAULT_BLACKLISTED_PLUGINS = Set.of("scmactivity", "issuesreport", "genericcoverage"); @@ -139,8 +140,7 @@ public class PluginJarLoader { } private static void logGenericPluginLoadErrorLog() { - Logger logger = Loggers.get(STARTUP_LOGGER_NAME); - logger.error(LOAD_ERROR_GENERIC_MESSAGE); + STARTUP_LOGGER.error(LOAD_ERROR_GENERIC_MESSAGE); } private List<ServerPluginInfo> getBundledPluginsMetadata() { diff --git a/server/sonar-webserver-api/src/main/java/org/sonar/server/plugins/PluginUninstaller.java b/server/sonar-webserver-api/src/main/java/org/sonar/server/plugins/PluginUninstaller.java index 63417c35831..f265b9017da 100644 --- a/server/sonar-webserver-api/src/main/java/org/sonar/server/plugins/PluginUninstaller.java +++ b/server/sonar-webserver-api/src/main/java/org/sonar/server/plugins/PluginUninstaller.java @@ -27,8 +27,8 @@ import java.util.HashSet; import java.util.Set; import org.apache.commons.io.FileUtils; import org.sonar.api.Startable; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.core.platform.PluginInfo; import org.sonar.core.util.stream.MoreCollectors; import org.sonar.server.platform.ServerFileSystem; @@ -39,7 +39,7 @@ import static org.apache.commons.io.FileUtils.moveFileToDirectory; import static org.sonar.core.plugin.PluginType.EXTERNAL; public class PluginUninstaller implements Startable { - private static final Logger LOG = Loggers.get(PluginUninstaller.class); + private static final Logger LOG = LoggerFactory.getLogger(PluginUninstaller.class); private static final String PLUGIN_EXTENSION = "jar"; private final ServerFileSystem fs; diff --git a/server/sonar-webserver-api/src/main/java/org/sonar/server/plugins/ServerPluginManager.java b/server/sonar-webserver-api/src/main/java/org/sonar/server/plugins/ServerPluginManager.java index 8d54c3e5f4e..0f01e3d475b 100644 --- a/server/sonar-webserver-api/src/main/java/org/sonar/server/plugins/ServerPluginManager.java +++ b/server/sonar-webserver-api/src/main/java/org/sonar/server/plugins/ServerPluginManager.java @@ -26,8 +26,8 @@ import java.util.Map; import java.util.stream.Collectors; import org.sonar.api.Startable; import org.sonar.api.Plugin; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.core.platform.ExplodedPlugin; import org.sonar.core.platform.PluginClassLoader; import org.sonar.core.platform.PluginJarExploder; @@ -43,7 +43,7 @@ import org.sonar.core.plugin.PluginType; * </ul> */ public class ServerPluginManager implements Startable { - private static final Logger LOG = Loggers.get(ServerPluginManager.class); + private static final Logger LOG = LoggerFactory.getLogger(ServerPluginManager.class); private final PluginJarLoader pluginJarLoader; private final PluginJarExploder pluginJarExploder; diff --git a/server/sonar-webserver-api/src/main/java/org/sonar/server/plugins/UpdateCenterClient.java b/server/sonar-webserver-api/src/main/java/org/sonar/server/plugins/UpdateCenterClient.java index 96ba6d9f9e3..83c5324e550 100644 --- a/server/sonar-webserver-api/src/main/java/org/sonar/server/plugins/UpdateCenterClient.java +++ b/server/sonar-webserver-api/src/main/java/org/sonar/server/plugins/UpdateCenterClient.java @@ -26,11 +26,12 @@ import java.nio.charset.StandardCharsets; import java.util.Date; import java.util.Optional; import org.apache.commons.io.IOUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.api.Properties; import org.sonar.api.Property; import org.sonar.api.config.Configuration; import org.sonar.api.utils.UriReader; -import org.sonar.api.utils.log.Loggers; import org.sonar.process.ProcessProperties; import org.sonar.updatecenter.common.UpdateCenter; import org.sonar.updatecenter.common.UpdateCenterDeserializer; @@ -59,6 +60,7 @@ import org.sonar.updatecenter.common.UpdateCenterDeserializer.Mode; }) public class UpdateCenterClient { + private static final Logger LOG = LoggerFactory.getLogger(UpdateCenterClient.class); public static final String URL_PROPERTY = "sonar.updatecenter.url"; public static final String CACHE_TTL_PROPERTY = "sonar.updatecenter.cache.ttl"; @@ -75,7 +77,8 @@ public class UpdateCenterClient { this.uri = new URI(config.get(URL_PROPERTY).get()); this.isActivated = config.getBoolean(ProcessProperties.Property.SONAR_UPDATECENTER_ACTIVATE.getKey()).get(); this.periodInMilliseconds = Long.parseLong(config.get(CACHE_TTL_PROPERTY).get()); - Loggers.get(getClass()).info("Update center: " + uriReader.description(uri)); + + LOG.info("Update center: {}", uriReader.description(uri)); } public Optional<UpdateCenter> getUpdateCenter() { @@ -112,7 +115,7 @@ public class UpdateCenterClient { return new UpdateCenterDeserializer(Mode.PROD, true).fromProperties(properties); } catch (Exception e) { - Loggers.get(getClass()).error("Fail to connect to update center", e); + LoggerFactory.getLogger(getClass()).error("Fail to connect to update center", e); return null; } finally { diff --git a/server/sonar-webserver-api/src/main/java/org/sonar/server/project/ProjectLifeCycleListenersImpl.java b/server/sonar-webserver-api/src/main/java/org/sonar/server/project/ProjectLifeCycleListenersImpl.java index 34af494a29f..78a4b644cc8 100644 --- a/server/sonar-webserver-api/src/main/java/org/sonar/server/project/ProjectLifeCycleListenersImpl.java +++ b/server/sonar-webserver-api/src/main/java/org/sonar/server/project/ProjectLifeCycleListenersImpl.java @@ -22,14 +22,14 @@ package org.sonar.server.project; import java.util.Arrays; import java.util.Set; import java.util.function.Consumer; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import static com.google.common.base.Preconditions.checkNotNull; public class ProjectLifeCycleListenersImpl implements ProjectLifeCycleListeners { - private static final Logger LOG = Loggers.get(ProjectLifeCycleListenersImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(ProjectLifeCycleListenersImpl.class); private final ProjectLifeCycleListener[] listeners; diff --git a/server/sonar-webserver-api/src/main/java/org/sonar/server/qualitygate/changeevent/QGChangeEventListenersImpl.java b/server/sonar-webserver-api/src/main/java/org/sonar/server/qualitygate/changeevent/QGChangeEventListenersImpl.java index 2a075243e25..7f545f8b5bf 100644 --- a/server/sonar-webserver-api/src/main/java/org/sonar/server/qualitygate/changeevent/QGChangeEventListenersImpl.java +++ b/server/sonar-webserver-api/src/main/java/org/sonar/server/qualitygate/changeevent/QGChangeEventListenersImpl.java @@ -24,8 +24,8 @@ import com.google.common.collect.Multimap; import java.util.Collection; import java.util.List; import java.util.Set; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.core.issue.DefaultIssue; import org.sonar.core.util.stream.MoreCollectors; import org.sonar.server.qualitygate.changeevent.QGChangeEventListener.ChangedIssue; @@ -41,7 +41,7 @@ import static org.sonar.core.util.stream.MoreCollectors.toSet; * prevent from calling the others. */ public class QGChangeEventListenersImpl implements QGChangeEventListeners { - private static final Logger LOG = Loggers.get(QGChangeEventListenersImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(QGChangeEventListenersImpl.class); private final Set<QGChangeEventListener> listeners; diff --git a/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/AuthenticationError.java b/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/AuthenticationError.java index 7a0aaa9eae9..05be7f4a36d 100644 --- a/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/AuthenticationError.java +++ b/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/AuthenticationError.java @@ -21,8 +21,8 @@ package org.sonar.server.authentication; import org.sonar.api.server.http.HttpRequest; import org.sonar.api.server.http.HttpResponse; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.server.authentication.event.AuthenticationException; import static org.sonar.server.authentication.AuthenticationRedirection.encodeMessage; @@ -33,7 +33,7 @@ public final class AuthenticationError { private static final String UNAUTHORIZED_PATH = "/sessions/unauthorized"; - private static final Logger LOGGER = Loggers.get(AuthenticationError.class); + private static final Logger LOGGER = LoggerFactory.getLogger(AuthenticationError.class); private static final String AUTHENTICATION_ERROR_COOKIE = "AUTHENTICATION-ERROR"; private static final int FIVE_MINUTES_IN_SECONDS = 5 * 60; diff --git a/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/DefaultAdminCredentialsVerifierImpl.java b/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/DefaultAdminCredentialsVerifierImpl.java index a9d09cc7676..6794c83e6dd 100644 --- a/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/DefaultAdminCredentialsVerifierImpl.java +++ b/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/DefaultAdminCredentialsVerifierImpl.java @@ -19,8 +19,8 @@ */ package org.sonar.server.authentication; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.db.user.UserDto; @@ -36,7 +36,7 @@ import static org.sonar.server.property.InternalProperties.DEFAULT_ADMIN_CREDENT */ public class DefaultAdminCredentialsVerifierImpl implements DefaultAdminCredentialsVerifier { - private static final Logger LOGGER = Loggers.get(STARTUP_LOGGER_NAME); + private static final Logger LOGGER = LoggerFactory.getLogger(STARTUP_LOGGER_NAME); private final DbClient dbClient; private final CredentialsLocalAuthentication localAuthentication; diff --git a/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/GithubWebhookAuthentication.java b/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/GithubWebhookAuthentication.java index d64279bd806..a266aeedaa6 100644 --- a/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/GithubWebhookAuthentication.java +++ b/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/GithubWebhookAuthentication.java @@ -27,8 +27,8 @@ import org.apache.commons.codec.digest.HmacUtils; import org.sonar.api.config.internal.Encryption; import org.sonar.api.config.internal.Settings; import org.sonar.api.server.http.HttpRequest; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.db.alm.setting.ALM; @@ -42,7 +42,7 @@ import static org.apache.commons.lang.StringUtils.isEmpty; import static org.sonar.server.user.GithubWebhookUserSession.GITHUB_WEBHOOK_USER_NAME; public class GithubWebhookAuthentication { - private static final Logger LOG = Loggers.get(GithubWebhookAuthentication.class); + private static final Logger LOG = LoggerFactory.getLogger(GithubWebhookAuthentication.class); @VisibleForTesting static final String GITHUB_SIGNATURE_HEADER = "x-hub-signature-256"; diff --git a/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/HttpHeadersAuthentication.java b/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/HttpHeadersAuthentication.java index 392c1ab1715..bfb8d6e5458 100644 --- a/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/HttpHeadersAuthentication.java +++ b/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/HttpHeadersAuthentication.java @@ -37,8 +37,8 @@ import org.sonar.api.server.authentication.UserIdentity; import org.sonar.api.server.http.HttpRequest; import org.sonar.api.server.http.HttpResponse; import org.sonar.api.utils.System2; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.db.user.UserDto; import org.sonar.process.ProcessProperties; import org.sonar.server.authentication.event.AuthenticationEvent; @@ -61,7 +61,7 @@ import static org.sonar.server.user.ExternalIdentity.SQ_AUTHORITY; */ public class HttpHeadersAuthentication implements Startable { - private static final Logger LOG = Loggers.get(HttpHeadersAuthentication.class); + private static final Logger LOG = LoggerFactory.getLogger(HttpHeadersAuthentication.class); private static final Splitter COMA_SPLITTER = Splitter.on(",").trimResults().omitEmptyStrings(); diff --git a/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/LdapCredentialsAuthentication.java b/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/LdapCredentialsAuthentication.java index 371d40741b3..b8f3718649d 100644 --- a/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/LdapCredentialsAuthentication.java +++ b/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/LdapCredentialsAuthentication.java @@ -28,8 +28,8 @@ import org.sonar.api.server.authentication.Display; import org.sonar.api.server.authentication.IdentityProvider; import org.sonar.api.server.authentication.UserIdentity; import org.sonar.api.server.http.HttpRequest; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.auth.ldap.LdapAuthenticationResult; import org.sonar.auth.ldap.LdapAuthenticator; import org.sonar.auth.ldap.LdapGroupsProvider; @@ -46,7 +46,7 @@ import static org.apache.commons.lang.StringUtils.trimToNull; public class LdapCredentialsAuthentication { - private static final Logger LOG = Loggers.get(LdapCredentialsAuthentication.class); + private static final Logger LOG = LoggerFactory.getLogger(LdapCredentialsAuthentication.class); private final Configuration configuration; private final UserRegistrar userRegistrar; diff --git a/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/LogOAuthWarning.java b/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/LogOAuthWarning.java index 213cf53955e..8ffed42ac46 100644 --- a/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/LogOAuthWarning.java +++ b/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/LogOAuthWarning.java @@ -23,7 +23,7 @@ import org.apache.commons.lang.StringUtils; import org.sonar.api.Startable; import org.sonar.api.platform.Server; import org.sonar.api.server.authentication.OAuth2IdentityProvider; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; public class LogOAuthWarning implements Startable { @@ -52,7 +52,7 @@ public class LogOAuthWarning implements Startable { } String publicRootUrl = server.getPublicRootUrl(); if (StringUtils.startsWithIgnoreCase(publicRootUrl, "http:")) { - Loggers.get(getClass()).warn( + LoggerFactory.getLogger(getClass()).warn( "For security reasons, OAuth authentication should use HTTPS. You should set the property 'Administration > Configuration > Server base URL' to a HTTPS URL."); } } diff --git a/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/UserRegistrarImpl.java b/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/UserRegistrarImpl.java index 8ac82b36844..aa70ab9bdab 100644 --- a/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/UserRegistrarImpl.java +++ b/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/UserRegistrarImpl.java @@ -33,8 +33,8 @@ import javax.annotation.CheckForNull; import javax.annotation.Nullable; import org.sonar.api.server.authentication.IdentityProvider; import org.sonar.api.server.authentication.UserIdentity; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.db.user.GroupDto; @@ -58,7 +58,7 @@ public class UserRegistrarImpl implements UserRegistrar { public static final String SQ_AUTHORITY = "sonarqube"; public static final String LDAP_PROVIDER_PREFIX = "LDAP_"; - private static final Logger LOGGER = Loggers.get(UserRegistrarImpl.class); + private static final Logger LOGGER = LoggerFactory.getLogger(UserRegistrarImpl.class); public static final String GITHUB_PROVIDER = "github"; public static final String GITLAB_PROVIDER = "gitlab"; diff --git a/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/event/AuthenticationEventImpl.java b/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/event/AuthenticationEventImpl.java index 6000f752b47..da58355b179 100644 --- a/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/event/AuthenticationEventImpl.java +++ b/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/event/AuthenticationEventImpl.java @@ -23,14 +23,14 @@ import com.google.common.base.Joiner; import java.util.Collections; import javax.annotation.Nullable; import org.sonar.api.server.http.HttpRequest; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.core.util.stream.MoreCollectors; import static java.util.Objects.requireNonNull; public class AuthenticationEventImpl implements AuthenticationEvent { - private static final Logger LOGGER = Loggers.get("auth.event"); + private static final Logger LOGGER = LoggerFactory.getLogger("auth.event"); private static final int FLOOD_THRESHOLD = 128; @Override diff --git a/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/purge/ExpiredSessionsCleaner.java b/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/purge/ExpiredSessionsCleaner.java index 9ea010aac55..3e291646da2 100644 --- a/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/purge/ExpiredSessionsCleaner.java +++ b/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/purge/ExpiredSessionsCleaner.java @@ -21,15 +21,15 @@ package org.sonar.server.authentication.purge; import java.util.concurrent.TimeUnit; import org.sonar.api.Startable; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.server.util.GlobalLockManager; public class ExpiredSessionsCleaner implements Startable { - private static final Logger LOG = Loggers.get(ExpiredSessionsCleaner.class); + private static final Logger LOG = LoggerFactory.getLogger(ExpiredSessionsCleaner.class); private static final long PERIOD_IN_SECONDS = 24 * 60 * 60L; private static final String LOCK_NAME = "SessionCleaner"; diff --git a/server/sonar-webserver-auth/src/main/java/org/sonar/server/user/NewUserNotifier.java b/server/sonar-webserver-auth/src/main/java/org/sonar/server/user/NewUserNotifier.java index 57a78f3bbd3..4ada7794a66 100644 --- a/server/sonar-webserver-auth/src/main/java/org/sonar/server/user/NewUserNotifier.java +++ b/server/sonar-webserver-auth/src/main/java/org/sonar/server/user/NewUserNotifier.java @@ -19,9 +19,10 @@ */ package org.sonar.server.user; +import org.slf4j.Logger; import org.sonar.api.server.ServerSide; import org.sonar.api.platform.NewUserHandler; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; /** @@ -30,6 +31,7 @@ import org.springframework.beans.factory.annotation.Autowired; @ServerSide public class NewUserNotifier { + private static final Logger LOG = LoggerFactory.getLogger(NewUserNotifier.class); private final NewUserHandler[] handlers; @Autowired(required = false) @@ -43,7 +45,7 @@ public class NewUserNotifier { } public void onNewUser(NewUserHandler.Context context) { - Loggers.get(NewUserNotifier.class).debug("User created: " + context.getLogin() + ". Notifying " + NewUserHandler.class.getSimpleName() + " handlers..."); + LOG.debug("User created: {}. Notifying {} handlers...",context.getLogin(), NewUserHandler.class.getSimpleName() ); for (NewUserHandler handler : handlers) { handler.doOnNewUser(context); } diff --git a/server/sonar-webserver-auth/src/main/java/org/sonar/server/user/SecurityRealmFactory.java b/server/sonar-webserver-auth/src/main/java/org/sonar/server/user/SecurityRealmFactory.java index 1af510fa2b8..748534fd7ed 100644 --- a/server/sonar-webserver-auth/src/main/java/org/sonar/server/user/SecurityRealmFactory.java +++ b/server/sonar-webserver-auth/src/main/java/org/sonar/server/user/SecurityRealmFactory.java @@ -21,6 +21,8 @@ package org.sonar.server.user; import javax.annotation.Nullable; import org.apache.commons.lang.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.api.CoreProperties; import org.sonar.api.Startable; import org.sonar.api.config.Configuration; @@ -28,8 +30,6 @@ import org.sonar.api.security.LoginPasswordAuthenticator; import org.sonar.api.security.SecurityRealm; import org.sonar.api.server.ServerSide; import org.sonar.api.utils.SonarException; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; import org.springframework.beans.factory.annotation.Autowired; import static org.sonar.process.ProcessProperties.Property.SONAR_AUTHENTICATOR_IGNORE_STARTUP_FAILURE; @@ -41,6 +41,7 @@ import static org.sonar.process.ProcessProperties.Property.SONAR_SECURITY_REALM; @ServerSide public class SecurityRealmFactory implements Startable { + private static final Logger LOG = LoggerFactory.getLogger("org.sonar.INFO"); private static final String LDAP_SECURITY_REALM = "LDAP"; private final boolean ignoreStartupFailure; private final SecurityRealm realm; @@ -94,14 +95,13 @@ public class SecurityRealmFactory implements Startable { @Override public void start() { if (realm != null) { - Logger logger = Loggers.get("org.sonar.INFO"); try { - logger.info("Security realm: " + realm.getName()); + LOG.info("Security realm: {}", realm.getName()); realm.init(); - logger.info("Security realm started"); + LOG.info("Security realm started"); } catch (RuntimeException e) { if (ignoreStartupFailure) { - logger.error("IGNORED - Security realm fails to start: " + e.getMessage()); + LOG.error("IGNORED - Security realm fails to start: {}", e.getMessage()); } else { throw new SonarException("Security realm fails to start: " + e.getMessage(), e); } diff --git a/server/sonar-webserver-auth/src/main/java/org/sonar/server/user/SystemPasscodeImpl.java b/server/sonar-webserver-auth/src/main/java/org/sonar/server/user/SystemPasscodeImpl.java index b04bede3b3f..38d6f3a8373 100644 --- a/server/sonar-webserver-auth/src/main/java/org/sonar/server/user/SystemPasscodeImpl.java +++ b/server/sonar-webserver-auth/src/main/java/org/sonar/server/user/SystemPasscodeImpl.java @@ -27,7 +27,7 @@ import org.sonar.api.Startable; import org.sonar.api.config.Configuration; import org.sonar.api.server.ServerSide; import org.sonar.api.server.ws.Request; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.LoggerFactory; import static org.sonar.process.ProcessProperties.Property.WEB_SYSTEM_PASS_CODE; @@ -74,7 +74,7 @@ public class SystemPasscodeImpl implements SystemPasscode, Startable { } private void logState(String state) { - Loggers.get(getClass()).info("System authentication by passcode is {}", state); + LoggerFactory.getLogger(getClass()).info("System authentication by passcode is {}", state); } @Override diff --git a/server/sonar-webserver-auth/src/main/java/org/sonar/server/usertoken/notification/TokenExpirationNotificationSchedulerImpl.java b/server/sonar-webserver-auth/src/main/java/org/sonar/server/usertoken/notification/TokenExpirationNotificationSchedulerImpl.java index 6ebdc876978..e73f831cf1a 100644 --- a/server/sonar-webserver-auth/src/main/java/org/sonar/server/usertoken/notification/TokenExpirationNotificationSchedulerImpl.java +++ b/server/sonar-webserver-auth/src/main/java/org/sonar/server/usertoken/notification/TokenExpirationNotificationSchedulerImpl.java @@ -22,8 +22,8 @@ package org.sonar.server.usertoken.notification; import com.google.common.annotations.VisibleForTesting; import java.time.Duration; import java.time.LocalDateTime; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.server.util.GlobalLockManager; import static java.util.concurrent.TimeUnit.DAYS; @@ -33,7 +33,7 @@ public class TokenExpirationNotificationSchedulerImpl implements TokenExpiration // Lock 23 hours in case of server restart or multiple nodes in data center edition private static int LOCK_DURATION = 23 * 60 * 60; private static String LOCK_NAME = "token-notif"; - private static final Logger LOG = Loggers.get(TokenExpirationNotificationSchedulerImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(TokenExpirationNotificationSchedulerImpl.class); private final TokenExpirationNotificationExecutorService executorService; private final GlobalLockManager lockManager; private final TokenExpirationNotificationSender notificationSender; diff --git a/server/sonar-webserver-auth/src/main/java/org/sonar/server/usertoken/notification/TokenExpirationNotificationSender.java b/server/sonar-webserver-auth/src/main/java/org/sonar/server/usertoken/notification/TokenExpirationNotificationSender.java index d331d3c477b..5ec1d187286 100644 --- a/server/sonar-webserver-auth/src/main/java/org/sonar/server/usertoken/notification/TokenExpirationNotificationSender.java +++ b/server/sonar-webserver-auth/src/main/java/org/sonar/server/usertoken/notification/TokenExpirationNotificationSender.java @@ -22,14 +22,14 @@ package org.sonar.server.usertoken.notification; import java.util.Map; import java.util.stream.Collectors; import java.util.stream.Stream; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.db.DbClient; import org.sonar.db.user.UserDto; import org.sonar.db.user.UserTokenDto; public class TokenExpirationNotificationSender { - private static final Logger LOG = Loggers.get(TokenExpirationNotificationSender.class); + private static final Logger LOG = LoggerFactory.getLogger(TokenExpirationNotificationSender.class); private final DbClient dbClient; private final TokenExpirationEmailComposer emailComposer; diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/issue/index/AsyncIssueIndexingImpl.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/issue/index/AsyncIssueIndexingImpl.java index fd0c1f63ccd..dd0e001b6fe 100644 --- a/server/sonar-webserver-core/src/main/java/org/sonar/server/issue/index/AsyncIssueIndexingImpl.java +++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/issue/index/AsyncIssueIndexingImpl.java @@ -29,8 +29,8 @@ import java.util.function.Function; import java.util.stream.Collectors; import java.util.stream.Stream; import org.sonar.api.server.ServerSide; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.ce.queue.CeQueue; import org.sonar.ce.queue.CeTaskSubmit; import org.sonar.db.DbClient; @@ -50,7 +50,7 @@ import static org.sonar.db.ce.CeTaskTypes.BRANCH_ISSUE_SYNC; @ServerSide public class AsyncIssueIndexingImpl implements AsyncIssueIndexing { - private static final Logger LOG = Loggers.get(AsyncIssueIndexingImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(AsyncIssueIndexingImpl.class); private final CeQueue ceQueue; private final DbClient dbClient; diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/notification/NotificationDaemon.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/notification/NotificationDaemon.java index a098898cc50..02b41db061f 100644 --- a/server/sonar-webserver-core/src/main/java/org/sonar/server/notification/NotificationDaemon.java +++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/notification/NotificationDaemon.java @@ -30,8 +30,8 @@ import org.sonar.api.Property; import org.sonar.api.config.Configuration; import org.sonar.api.notifications.Notification; import org.sonar.api.server.ServerSide; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import static java.util.Collections.singleton; @@ -51,7 +51,7 @@ import static java.util.Collections.singleton; public class NotificationDaemon implements Startable { private static final String THREAD_NAME_PREFIX = "sq-notification-service-"; - private static final Logger LOG = Loggers.get(NotificationDaemon.class); + private static final Logger LOG = LoggerFactory.getLogger(NotificationDaemon.class); public static final String PROPERTY_DELAY = "sonar.notifications.delay"; public static final String PROPERTY_DELAY_BEFORE_REPORTING_STATUS = "sonar.notifications.runningDelayBeforeReportingStatus"; diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/DatabaseServerCompatibility.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/DatabaseServerCompatibility.java index 3019b0f836f..ce44950cd2e 100644 --- a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/DatabaseServerCompatibility.java +++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/DatabaseServerCompatibility.java @@ -22,8 +22,8 @@ package org.sonar.server.platform; import java.util.Optional; import org.sonar.api.Startable; import org.sonar.api.utils.MessageException; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.server.platform.db.migration.version.DatabaseVersion; import static org.sonar.server.log.ServerProcessLogging.STARTUP_LOGGER_NAME; @@ -53,8 +53,8 @@ public class DatabaseServerCompatibility implements Startable { String msg = "The database must be manually upgraded. Please backup the database and browse /setup. " + "For more information: https://docs.sonarqube.org/latest/setup/upgrading"; - Loggers.get(DatabaseServerCompatibility.class).warn(msg); - Logger logger = Loggers.get(STARTUP_LOGGER_NAME); + LoggerFactory.getLogger(DatabaseServerCompatibility.class).warn(msg); + Logger logger = LoggerFactory.getLogger(STARTUP_LOGGER_NAME); logger.warn(HIGHLIGHTER); logger.warn(msg); logger.warn(HIGHLIGHTER); diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/LogServerVersion.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/LogServerVersion.java index 2837de367b2..b430a98046d 100644 --- a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/LogServerVersion.java +++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/LogServerVersion.java @@ -26,14 +26,14 @@ import java.util.Properties; import org.sonar.api.Startable; import org.sonar.api.server.ServerSide; import org.sonar.api.utils.Version; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.core.platform.SonarQubeVersion; @ServerSide public class LogServerVersion implements Startable { - private static final Logger LOG = Loggers.get(LogServerVersion.class); + private static final Logger LOG = LoggerFactory.getLogger(LogServerVersion.class); private final SonarQubeVersion sonarQubeVersion; public LogServerVersion(SonarQubeVersion sonarQubeVersion) { diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/db/CheckAnyonePermissionsAtStartup.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/db/CheckAnyonePermissionsAtStartup.java index 1b23f17b284..d4e65650c20 100644 --- a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/db/CheckAnyonePermissionsAtStartup.java +++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/db/CheckAnyonePermissionsAtStartup.java @@ -23,8 +23,8 @@ import java.util.List; import java.util.Optional; import org.sonar.api.Startable; import org.sonar.api.config.Configuration; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.db.DbClient; import org.sonar.db.DbSession; @@ -35,7 +35,7 @@ import org.sonar.db.DbSession; */ public class CheckAnyonePermissionsAtStartup implements Startable { - private static final Logger LOG = Loggers.get(CheckAnyonePermissionsAtStartup.class); + private static final Logger LOG = LoggerFactory.getLogger(CheckAnyonePermissionsAtStartup.class); private static final String FORCE_AUTHENTICATION_PROPERTY_NAME = "sonar.forceAuthentication"; private final DbClient dbClient; private final Configuration config; diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/db/CheckLanguageSpecificParamsAtStartup.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/db/CheckLanguageSpecificParamsAtStartup.java index a3daa848af5..f5378e787c2 100644 --- a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/db/CheckLanguageSpecificParamsAtStartup.java +++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/db/CheckLanguageSpecificParamsAtStartup.java @@ -21,8 +21,8 @@ package org.sonar.server.platform.db; import org.sonar.api.Startable; import org.sonar.api.config.Configuration; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import static org.sonar.api.CoreProperties.LANGUAGE_SPECIFIC_PARAMETERS; @@ -32,7 +32,7 @@ import static org.sonar.api.CoreProperties.LANGUAGE_SPECIFIC_PARAMETERS; */ public class CheckLanguageSpecificParamsAtStartup implements Startable { - private static final Logger LOG = Loggers.get(CheckLanguageSpecificParamsAtStartup.class); + private static final Logger LOG = LoggerFactory.getLogger(CheckLanguageSpecificParamsAtStartup.class); private final Configuration config; diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/db/EmbeddedDatabase.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/db/EmbeddedDatabase.java index 23abb61ccac..8480ed08595 100644 --- a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/db/EmbeddedDatabase.java +++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/db/EmbeddedDatabase.java @@ -28,8 +28,8 @@ import org.h2.tools.Server; import org.sonar.api.Startable; import org.sonar.api.config.Configuration; import org.sonar.api.utils.System2; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import static com.google.common.base.Preconditions.checkArgument; import static java.lang.String.format; @@ -42,7 +42,7 @@ import static org.sonar.process.ProcessProperties.Property.PATH_DATA; public class EmbeddedDatabase implements Startable { private static final String IGNORED_KEYWORDS_OPTION = ";NON_KEYWORDS=VALUE"; - private static final Logger LOG = Loggers.get(EmbeddedDatabase.class); + private static final Logger LOG = LoggerFactory.getLogger(EmbeddedDatabase.class); private final Configuration config; private final System2 system2; diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/db/migration/AutoDbMigration.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/db/migration/AutoDbMigration.java index da702850a87..1a3a0e51235 100644 --- a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/db/migration/AutoDbMigration.java +++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/db/migration/AutoDbMigration.java @@ -20,7 +20,7 @@ package org.sonar.server.platform.db.migration; import org.sonar.api.Startable; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.LoggerFactory; import org.sonar.server.platform.DefaultServerUpgradeStatus; import org.sonar.server.platform.db.migration.engine.MigrationEngine; @@ -36,10 +36,10 @@ public class AutoDbMigration implements Startable { @Override public void start() { if (serverUpgradeStatus.isFreshInstall()) { - Loggers.get(getClass()).info("Automatically perform DB migration on fresh install"); + LoggerFactory.getLogger(getClass()).info("Automatically perform DB migration on fresh install"); migrationEngine.execute(); } else if (serverUpgradeStatus.isUpgraded() && serverUpgradeStatus.isAutoDbUpgrade()) { - Loggers.get(getClass()).info("Automatically perform DB migration, as automatic database upgrade is enabled"); + LoggerFactory.getLogger(getClass()).info("Automatically perform DB migration, as automatic database upgrade is enabled"); migrationEngine.execute(); } } diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/db/migration/DatabaseMigrationImpl.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/db/migration/DatabaseMigrationImpl.java index acef78a34de..4e47ebd790a 100644 --- a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/db/migration/DatabaseMigrationImpl.java +++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/db/migration/DatabaseMigrationImpl.java @@ -21,8 +21,8 @@ package org.sonar.server.platform.db.migration; import java.util.Date; import java.util.concurrent.Semaphore; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.core.util.logs.Profiler; import org.sonar.server.platform.Platform; import org.sonar.server.platform.db.migration.DatabaseMigrationState.Status; @@ -34,7 +34,7 @@ import org.sonar.server.platform.db.migration.step.MigrationStepExecutionExcepti */ public class DatabaseMigrationImpl implements DatabaseMigration { - private static final Logger LOGGER = Loggers.get(DatabaseMigrationImpl.class); + private static final Logger LOGGER = LoggerFactory.getLogger(DatabaseMigrationImpl.class); /** * ExecutorService implements threads management. diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/monitoring/EsIndexesSection.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/monitoring/EsIndexesSection.java index 649c573874a..c00c234c1d8 100644 --- a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/monitoring/EsIndexesSection.java +++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/monitoring/EsIndexesSection.java @@ -21,7 +21,7 @@ package org.sonar.server.platform.monitoring; import org.elasticsearch.ElasticsearchException; import org.sonar.api.server.ServerSide; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.LoggerFactory; import org.sonar.process.systeminfo.Global; import org.sonar.process.systeminfo.SystemInfoSection; import org.sonar.process.systeminfo.protobuf.ProtobufSystemInfo; @@ -48,7 +48,7 @@ public class EsIndexesSection implements SystemInfoSection, Global { try { completeIndexAttributes(protobuf); } catch (Exception es) { - Loggers.get(EsIndexesSection.class).warn("Failed to retrieve ES attributes. There will be only a single \"Error\" attribute.", es); + LoggerFactory.getLogger(EsIndexesSection.class).warn("Failed to retrieve ES attributes. There will be only a single \"Error\" attribute.", es); setAttribute(protobuf, "Error", es.getCause() instanceof ElasticsearchException ? es.getCause().getMessage() : es.getMessage()); } return protobuf.build(); diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/monitoring/EsStateSection.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/monitoring/EsStateSection.java index 6c4f112b401..7cd366ca30d 100644 --- a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/monitoring/EsStateSection.java +++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/monitoring/EsStateSection.java @@ -23,7 +23,7 @@ import java.util.Locale; import org.elasticsearch.ElasticsearchException; import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest; import org.elasticsearch.cluster.health.ClusterHealthStatus; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.LoggerFactory; import org.sonar.process.systeminfo.SystemInfoSection; import org.sonar.process.systeminfo.protobuf.ProtobufSystemInfo; import org.sonar.server.es.EsClient; @@ -54,7 +54,7 @@ public class EsStateSection implements SystemInfoSection { setAttribute(protobuf, "State", getStateAsEnum().name()); completeNodeAttributes(protobuf); } catch (Exception es) { - Loggers.get(EsStateSection.class).warn("Failed to retrieve ES attributes. There will be only a single \"state\" attribute.", es); + LoggerFactory.getLogger(EsStateSection.class).warn("Failed to retrieve ES attributes. There will be only a single \"state\" attribute.", es); setAttribute(protobuf, "State", es.getCause() instanceof ElasticsearchException ? es.getCause().getMessage() : es.getMessage()); } return protobuf.build(); diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/serverid/ServerIdManager.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/serverid/ServerIdManager.java index 96241fa52ae..8fe9ede6a4b 100644 --- a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/serverid/ServerIdManager.java +++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/serverid/ServerIdManager.java @@ -23,8 +23,8 @@ import java.util.Optional; import org.sonar.api.SonarQubeSide; import org.sonar.api.SonarRuntime; import org.sonar.api.Startable; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.core.platform.ServerId; import org.sonar.db.DbClient; import org.sonar.db.DbSession; @@ -39,7 +39,7 @@ import static org.sonar.api.CoreProperties.SERVER_ID; import static org.sonar.server.property.InternalProperties.SERVER_ID_CHECKSUM; public class ServerIdManager implements Startable { - private static final Logger LOGGER = Loggers.get(ServerIdManager.class); + private static final Logger LOGGER = LoggerFactory.getLogger(ServerIdManager.class); private final ServerIdChecksum serverIdChecksum; private final ServerIdFactory serverIdFactory; diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/web/RootFilter.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/web/RootFilter.java index 4803903e9f9..c19985b9197 100644 --- a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/web/RootFilter.java +++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/web/RootFilter.java @@ -33,7 +33,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequestWrapper; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import static java.lang.String.format; import static java.util.stream.Collectors.joining; @@ -49,7 +50,7 @@ import static java.util.stream.Collectors.joining; */ public class RootFilter implements Filter { - private static final org.sonar.api.utils.log.Logger LOGGER = Loggers.get(RootFilter.class); + private static final Logger LOGGER = LoggerFactory.getLogger(RootFilter.class); @Override public void init(FilterConfig filterConfig) { diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/qualitygate/ProjectsInWarningDaemon.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/qualitygate/ProjectsInWarningDaemon.java index 5368d218283..e44915dca5f 100644 --- a/server/sonar-webserver-core/src/main/java/org/sonar/server/qualitygate/ProjectsInWarningDaemon.java +++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/qualitygate/ProjectsInWarningDaemon.java @@ -27,8 +27,8 @@ import java.util.concurrent.ThreadFactory; import java.util.concurrent.TimeUnit; import org.sonar.api.Startable; import org.sonar.api.config.Configuration; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.server.es.SearchOptions; @@ -48,7 +48,7 @@ public class ProjectsInWarningDaemon implements Startable { static final String PROJECTS_IN_WARNING_INTERNAL_PROPERTY = "projectsInWarning"; - private static final Logger LOG = Loggers.get(ProjectsInWarningDaemon.class); + private static final Logger LOG = LoggerFactory.getLogger(ProjectsInWarningDaemon.class); private static final String FREQUENCY_IN_MILLISECONDS_PROPERTY = "sonar.projectsInWarning.frequencyInMilliseconds"; private static final int DEFAULT_FREQUENCY_IN_MILLISECONDS = 1000 * 60 * 60 * 24; diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/startup/LogServerId.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/startup/LogServerId.java index 872b34eef55..90f8d409fd2 100644 --- a/server/sonar-webserver-core/src/main/java/org/sonar/server/startup/LogServerId.java +++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/startup/LogServerId.java @@ -19,12 +19,14 @@ */ package org.sonar.server.startup; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.api.Startable; import org.sonar.api.platform.Server; -import org.sonar.api.utils.log.Loggers; public final class LogServerId implements Startable { + private static final Logger LOG = LoggerFactory.getLogger(LogServerId.class); private final Server server; public LogServerId(Server server) { @@ -33,7 +35,7 @@ public final class LogServerId implements Startable { @Override public void start() { - Loggers.get(getClass()).info("Server ID: " + server.getId()); + LOG.info("Server ID: {}", server.getId()); } @Override diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/startup/RenameDeprecatedPropertyKeys.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/startup/RenameDeprecatedPropertyKeys.java index fc54a4a7528..35936a95bb5 100644 --- a/server/sonar-webserver-core/src/main/java/org/sonar/server/startup/RenameDeprecatedPropertyKeys.java +++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/startup/RenameDeprecatedPropertyKeys.java @@ -23,7 +23,7 @@ import com.google.common.base.Strings; import org.sonar.api.Startable; import org.sonar.api.config.PropertyDefinition; import org.sonar.api.config.PropertyDefinitions; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.LoggerFactory; import org.sonar.db.property.PropertiesDao; /** @@ -41,7 +41,7 @@ public class RenameDeprecatedPropertyKeys implements Startable { @Override public void start() { - Loggers.get(RenameDeprecatedPropertyKeys.class).info("Rename deprecated property keys"); + LoggerFactory.getLogger(RenameDeprecatedPropertyKeys.class).info("Rename deprecated property keys"); for (PropertyDefinition definition : definitions.getAll()) { if (!Strings.isNullOrEmpty(definition.deprecatedKey())) { dao.renamePropertyKey(definition.deprecatedKey(), definition.key()); diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/startup/UpgradeSuggestionsCleaner.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/startup/UpgradeSuggestionsCleaner.java index 0e0fffbc326..8dbd9a916ae 100644 --- a/server/sonar-webserver-core/src/main/java/org/sonar/server/startup/UpgradeSuggestionsCleaner.java +++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/startup/UpgradeSuggestionsCleaner.java @@ -23,8 +23,8 @@ import org.sonar.api.Startable; import org.sonar.api.SonarEdition; import org.sonar.api.SonarRuntime; import org.sonar.api.server.ServerSide; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.db.ce.CeTaskMessageType; @@ -35,7 +35,7 @@ import org.sonar.db.ce.CeTaskMessageType; @ServerSide public class UpgradeSuggestionsCleaner implements Startable { - private static final Logger LOGGER = Loggers.get(UpgradeSuggestionsCleaner.class); + private static final Logger LOGGER = LoggerFactory.getLogger(UpgradeSuggestionsCleaner.class); private final DbClient dbClient; private final SonarRuntime sonarRuntime; diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/telemetry/TelemetryClient.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/telemetry/TelemetryClient.java index 8972ce16656..c025f604f25 100644 --- a/server/sonar-webserver-core/src/main/java/org/sonar/server/telemetry/TelemetryClient.java +++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/telemetry/TelemetryClient.java @@ -32,8 +32,8 @@ import okio.Okio; import org.sonar.api.Startable; import org.sonar.api.config.Configuration; import org.sonar.api.server.ServerSide; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import static org.sonar.process.ProcessProperties.Property.SONAR_TELEMETRY_COMPRESSION; import static org.sonar.process.ProcessProperties.Property.SONAR_TELEMETRY_URL; @@ -41,7 +41,7 @@ import static org.sonar.process.ProcessProperties.Property.SONAR_TELEMETRY_URL; @ServerSide public class TelemetryClient implements Startable { private static final MediaType JSON = MediaType.parse("application/json; charset=utf-8"); - private static final Logger LOG = Loggers.get(TelemetryClient.class); + private static final Logger LOG = LoggerFactory.getLogger(TelemetryClient.class); private final OkHttpClient okHttpClient; private final Configuration config; diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/telemetry/TelemetryDaemon.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/telemetry/TelemetryDaemon.java index fe9ad60ea11..f94a25eec71 100644 --- a/server/sonar-webserver-core/src/main/java/org/sonar/server/telemetry/TelemetryDaemon.java +++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/telemetry/TelemetryDaemon.java @@ -30,8 +30,8 @@ import java.util.concurrent.TimeUnit; import org.sonar.api.config.Configuration; import org.sonar.api.server.ServerSide; import org.sonar.api.utils.System2; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.api.utils.text.JsonWriter; import org.sonar.server.property.InternalProperties; import org.sonar.server.util.AbstractStoppableScheduledExecutorServiceImpl; @@ -48,7 +48,7 @@ public class TelemetryDaemon extends AbstractStoppableScheduledExecutorServiceIm private static final String I_PROP_LAST_PING = "telemetry.lastPing"; private static final String I_PROP_OPT_OUT = "telemetry.optOut"; private static final String LOCK_NAME = "TelemetryStat"; - private static final Logger LOG = Loggers.get(TelemetryDaemon.class); + private static final Logger LOG = LoggerFactory.getLogger(TelemetryDaemon.class); private static final String LOCK_DELAY_SEC = "sonar.telemetry.lock.delay"; static final String I_PROP_MESSAGE_SEQUENCE = "telemetry.messageSeq"; diff --git a/server/sonar-webserver-es/src/main/java/org/sonar/server/es/IndexCreator.java b/server/sonar-webserver-es/src/main/java/org/sonar/server/es/IndexCreator.java index 6c1c316ba71..679812747c3 100644 --- a/server/sonar-webserver-es/src/main/java/org/sonar/server/es/IndexCreator.java +++ b/server/sonar-webserver-es/src/main/java/org/sonar/server/es/IndexCreator.java @@ -37,8 +37,8 @@ import org.elasticsearch.cluster.health.ClusterHealthStatus; import org.elasticsearch.common.settings.Settings; import org.sonar.api.Startable; import org.sonar.api.server.ServerSide; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.server.es.metadata.EsDbCompatibility; import org.sonar.server.es.metadata.MetadataIndex; import org.sonar.server.es.metadata.MetadataIndexDefinition; @@ -54,7 +54,7 @@ import static org.sonar.server.es.metadata.MetadataIndexDefinition.TYPE_METADATA @ServerSide public class IndexCreator implements Startable { - private static final Logger LOGGER = Loggers.get(IndexCreator.class); + private static final Logger LOGGER = LoggerFactory.getLogger(IndexCreator.class); private final MetadataIndexDefinition metadataIndexDefinition; private final MetadataIndex metadataIndex; diff --git a/server/sonar-webserver-es/src/main/java/org/sonar/server/issue/index/IssueQueryFactory.java b/server/sonar-webserver-es/src/main/java/org/sonar/server/issue/index/IssueQueryFactory.java index 7455abdbee1..3ae9b399210 100644 --- a/server/sonar-webserver-es/src/main/java/org/sonar/server/issue/index/IssueQueryFactory.java +++ b/server/sonar-webserver-es/src/main/java/org/sonar/server/issue/index/IssueQueryFactory.java @@ -46,8 +46,8 @@ import org.sonar.api.resources.Qualifiers; import org.sonar.api.rule.RuleKey; import org.sonar.api.rules.RuleType; import org.sonar.api.server.ServerSide; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.core.util.stream.MoreCollectors; import org.sonar.db.DbClient; import org.sonar.db.DbSession; @@ -90,7 +90,7 @@ import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_IN_NEW_CODE @ServerSide public class IssueQueryFactory { - private static final Logger LOGGER = Loggers.get(IssueQueryFactory.class); + private static final Logger LOGGER = LoggerFactory.getLogger(IssueQueryFactory.class); public static final String UNKNOWN = "<UNKNOWN>"; public static final List<String> ISSUE_STATUSES = STATUSES.stream() diff --git a/server/sonar-webserver-monitoring/src/main/java/org/sonar/server/monitoring/ElasticSearchMetricTask.java b/server/sonar-webserver-monitoring/src/main/java/org/sonar/server/monitoring/ElasticSearchMetricTask.java index dedea9150c8..7aef72bba61 100644 --- a/server/sonar-webserver-monitoring/src/main/java/org/sonar/server/monitoring/ElasticSearchMetricTask.java +++ b/server/sonar-webserver-monitoring/src/main/java/org/sonar/server/monitoring/ElasticSearchMetricTask.java @@ -22,15 +22,15 @@ package org.sonar.server.monitoring; import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest; import org.elasticsearch.cluster.health.ClusterHealthStatus; import org.sonar.api.config.Configuration; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.server.es.EsClient; import org.sonar.server.es.response.NodeStats; import org.sonar.server.es.response.NodeStatsResponse; public class ElasticSearchMetricTask implements MonitoringTask { - private static final Logger LOG = Loggers.get(ElasticSearchMetricTask.class); + private static final Logger LOG = LoggerFactory.getLogger(ElasticSearchMetricTask.class); private static final String DELAY_IN_MILISECONDS_PROPERTY = "sonar.server.monitoring.es.initial.delay"; private static final String PERIOD_IN_MILISECONDS_PROPERTY = "sonar.server.monitoring.es.period"; diff --git a/server/sonar-webserver-monitoring/src/main/java/org/sonar/server/monitoring/ce/RecentTasksDurationTask.java b/server/sonar-webserver-monitoring/src/main/java/org/sonar/server/monitoring/ce/RecentTasksDurationTask.java index 1b872b6720a..0746b46ce1d 100644 --- a/server/sonar-webserver-monitoring/src/main/java/org/sonar/server/monitoring/ce/RecentTasksDurationTask.java +++ b/server/sonar-webserver-monitoring/src/main/java/org/sonar/server/monitoring/ce/RecentTasksDurationTask.java @@ -25,8 +25,8 @@ import java.util.Map; import java.util.stream.Collectors; import org.sonar.api.config.Configuration; import org.sonar.api.utils.System2; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.db.ce.CeActivityDto; @@ -37,7 +37,7 @@ import static java.util.Objects.requireNonNull; public class RecentTasksDurationTask extends ComputeEngineMetricsTask { - private static final Logger LOGGER = Loggers.get(RecentTasksDurationTask.class); + private static final Logger LOGGER = LoggerFactory.getLogger(RecentTasksDurationTask.class); private final System2 system; private long lastUpdatedTimestamp; diff --git a/server/sonar-webserver-pushapi/src/main/java/org/sonar/server/pushapi/ServerPushClient.java b/server/sonar-webserver-pushapi/src/main/java/org/sonar/server/pushapi/ServerPushClient.java index 682bd8fe82e..812a5518633 100644 --- a/server/sonar-webserver-pushapi/src/main/java/org/sonar/server/pushapi/ServerPushClient.java +++ b/server/sonar-webserver-pushapi/src/main/java/org/sonar/server/pushapi/ServerPushClient.java @@ -27,12 +27,12 @@ import java.util.concurrent.TimeUnit; import javax.servlet.AsyncContext; import javax.servlet.AsyncListener; import javax.servlet.ServletOutputStream; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public abstract class ServerPushClient { - private static final Logger LOG = Loggers.get(ServerPushClient.class); + private static final Logger LOG = LoggerFactory.getLogger(ServerPushClient.class); private static final int DEFAULT_HEARTBEAT_PERIOD = 20; protected final AsyncContext asyncContext; diff --git a/server/sonar-webserver-pushapi/src/main/java/org/sonar/server/pushapi/scheduler/polling/PushEventPollScheduler.java b/server/sonar-webserver-pushapi/src/main/java/org/sonar/server/pushapi/scheduler/polling/PushEventPollScheduler.java index 7a1f3d4a99b..152970c696e 100644 --- a/server/sonar-webserver-pushapi/src/main/java/org/sonar/server/pushapi/scheduler/polling/PushEventPollScheduler.java +++ b/server/sonar-webserver-pushapi/src/main/java/org/sonar/server/pushapi/scheduler/polling/PushEventPollScheduler.java @@ -31,8 +31,8 @@ import org.sonar.api.Startable; import org.sonar.api.config.Configuration; import org.sonar.api.server.ServerSide; import org.sonar.api.utils.System2; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.db.pushevent.PushEventDto; @@ -43,7 +43,7 @@ import org.sonar.server.pushapi.sonarlint.SonarLintPushEvent; @ServerSide public class PushEventPollScheduler implements Startable { - private static final Logger LOG = Loggers.get(PushEventPollScheduler.class); + private static final Logger LOG = LoggerFactory.getLogger(PushEventPollScheduler.class); private static final String INITIAL_DELAY_IN_SECONDS = "sonar.pushevents.polling.initial.delay"; private static final String LAST_TIMESTAMP_IN_SECONDS = "sonar.pushevents.polling.last.timestamp"; diff --git a/server/sonar-webserver-pushapi/src/main/java/org/sonar/server/pushapi/scheduler/purge/PushEventsPurgeScheduler.java b/server/sonar-webserver-pushapi/src/main/java/org/sonar/server/pushapi/scheduler/purge/PushEventsPurgeScheduler.java index 71b8c89b454..a62c56675d4 100644 --- a/server/sonar-webserver-pushapi/src/main/java/org/sonar/server/pushapi/scheduler/purge/PushEventsPurgeScheduler.java +++ b/server/sonar-webserver-pushapi/src/main/java/org/sonar/server/pushapi/scheduler/purge/PushEventsPurgeScheduler.java @@ -27,8 +27,8 @@ import org.sonar.api.Startable; import org.sonar.api.config.Configuration; import org.sonar.api.server.ServerSide; import org.sonar.api.utils.System2; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.server.util.GlobalLockManager; @@ -37,7 +37,7 @@ import static java.util.concurrent.TimeUnit.SECONDS; @ServerSide public class PushEventsPurgeScheduler implements Startable { - private static final Logger LOG = Loggers.get(PushEventsPurgeScheduler.class); + private static final Logger LOG = LoggerFactory.getLogger(PushEventsPurgeScheduler.class); private static final String LOCK_NAME = "PushPurgeCheck"; @VisibleForTesting diff --git a/server/sonar-webserver-pushapi/src/main/java/org/sonar/server/pushapi/sonarlint/SonarLintClientsRegistry.java b/server/sonar-webserver-pushapi/src/main/java/org/sonar/server/pushapi/sonarlint/SonarLintClientsRegistry.java index 7202a3c19cc..9c6f8d59a1e 100644 --- a/server/sonar-webserver-pushapi/src/main/java/org/sonar/server/pushapi/sonarlint/SonarLintClientsRegistry.java +++ b/server/sonar-webserver-pushapi/src/main/java/org/sonar/server/pushapi/sonarlint/SonarLintClientsRegistry.java @@ -27,14 +27,14 @@ import java.util.concurrent.CopyOnWriteArrayList; import javax.servlet.AsyncEvent; import javax.servlet.AsyncListener; import org.sonar.api.server.ServerSide; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.server.exceptions.ForbiddenException; @ServerSide public class SonarLintClientsRegistry { - private static final Logger LOG = Loggers.get(SonarLintClientsRegistry.class); + private static final Logger LOG = LoggerFactory.getLogger(SonarLintClientsRegistry.class); private final SonarLintClientPermissionsValidator sonarLintClientPermissionsValidator; private final List<SonarLintClient> clients = new CopyOnWriteArrayList<>(); diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/almintegration/ws/azure/SearchAzureReposAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/almintegration/ws/azure/SearchAzureReposAction.java index 5e1c36817d0..b455f19fe0b 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/almintegration/ws/azure/SearchAzureReposAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/almintegration/ws/azure/SearchAzureReposAction.java @@ -35,8 +35,8 @@ import org.sonar.alm.client.azure.GsonAzureRepoList; import org.sonar.api.server.ws.Request; import org.sonar.api.server.ws.Response; import org.sonar.api.server.ws.WebService; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.db.alm.pat.AlmPatDto; @@ -59,7 +59,7 @@ import static org.sonar.server.ws.WsUtils.writeProtobuf; public class SearchAzureReposAction implements AlmIntegrationsWsAction { - private static final Logger LOG = Loggers.get(SearchAzureReposAction.class); + private static final Logger LOG = LoggerFactory.getLogger(SearchAzureReposAction.class); private static final String PARAM_ALM_SETTING = "almSetting"; private static final String PARAM_PROJECT_NAME = "projectName"; diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/ce/queue/CeQueueCleaner.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/ce/queue/CeQueueCleaner.java index 4d0400b2833..ef251cd64c1 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/ce/queue/CeQueueCleaner.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/ce/queue/CeQueueCleaner.java @@ -23,8 +23,8 @@ import java.util.List; import org.sonar.api.Startable; import org.sonar.api.platform.ServerUpgradeStatus; import org.sonar.api.server.ServerSide; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.ce.queue.CeQueue; import org.sonar.db.DbClient; import org.sonar.db.DbSession; @@ -35,7 +35,7 @@ import org.sonar.db.DbSession; @ServerSide public class CeQueueCleaner implements Startable { - private static final Logger LOGGER = Loggers.get(CeQueueCleaner.class); + private static final Logger LOGGER = LoggerFactory.getLogger(CeQueueCleaner.class); private final DbClient dbClient; private final ServerUpgradeStatus serverUpgradeStatus; diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/ce/ws/IsQueueEmptyWs.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/ce/ws/IsQueueEmptyWs.java index a648b2ba558..f00cf7d7364 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/ce/ws/IsQueueEmptyWs.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/ce/ws/IsQueueEmptyWs.java @@ -24,7 +24,7 @@ import org.sonar.api.server.ws.Request; import org.sonar.api.server.ws.RequestHandler; import org.sonar.api.server.ws.Response; import org.sonar.api.server.ws.WebService; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.LoggerFactory; import org.sonar.db.DbClient; import org.sonar.db.DbSession; @@ -75,7 +75,7 @@ public class IsQueueEmptyWs implements WebService { isQueueEmpty = dbClient.ceQueueDao().selectAllInAscOrder(dbSession).isEmpty(); } catch (Exception e) { // ignore this FP : https://gist.github.com/simonbrandhof/3d98f854d427519ef5b858a73b59585b - Loggers.get(getClass()).error("Cannot select rows from ce_queue", e); + LoggerFactory.getLogger(getClass()).error("Cannot select rows from ce_queue", e); } IOUtils.write(String.valueOf(isQueueEmpty), response.stream().output(), UTF_8); } diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/health/DbConnectionNodeCheck.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/health/DbConnectionNodeCheck.java index 57dd8300fd3..99d29518bb9 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/health/DbConnectionNodeCheck.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/health/DbConnectionNodeCheck.java @@ -19,8 +19,8 @@ */ package org.sonar.server.health; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.db.IsAliveMapper; @@ -29,7 +29,7 @@ import org.sonar.db.IsAliveMapper; * Checks Web Server can connect to the Database. */ public class DbConnectionNodeCheck implements NodeHealthCheck { - private static final Logger LOGGER = Loggers.get(DbConnectionNodeCheck.class); + private static final Logger LOGGER = LoggerFactory.getLogger(DbConnectionNodeCheck.class); private static final Health RED_HEALTH = Health.builder().setStatus(Health.Status.RED).addCause("Can't connect to DB").build(); private final DbClient dbClient; diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/health/EsStatusCheck.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/health/EsStatusCheck.java index b58430a1689..e2287818f21 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/health/EsStatusCheck.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/health/EsStatusCheck.java @@ -22,12 +22,12 @@ package org.sonar.server.health; import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest; import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; import org.elasticsearch.cluster.health.ClusterHealthStatus; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.server.es.EsClient; abstract class EsStatusCheck { - private static final Logger LOG = Loggers.get(EsStatusCheck.class); + private static final Logger LOG = LoggerFactory.getLogger(EsStatusCheck.class); private static final Health YELLOW_HEALTH = Health.builder() .setStatus(Health.Status.YELLOW) diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/BulkChangeAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/BulkChangeAction.java index 6c0c69a7c77..2b57a463441 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/BulkChangeAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/BulkChangeAction.java @@ -42,8 +42,8 @@ import org.sonar.api.server.ws.Request; import org.sonar.api.server.ws.Response; import org.sonar.api.server.ws.WebService; import org.sonar.api.utils.System2; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.api.web.UserRole; import org.sonar.core.issue.DefaultIssue; import org.sonar.core.issue.IssueChangeContext; @@ -118,7 +118,7 @@ import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_SET_TYPE; public class BulkChangeAction implements IssuesWsAction { - private static final Logger LOG = Loggers.get(BulkChangeAction.class); + private static final Logger LOG = LoggerFactory.getLogger(BulkChangeAction.class); private static final List<String> ACTIONS_TO_DISTRIBUTE = List.of(SET_SEVERITY_KEY, SET_TYPE_KEY, DO_TRANSITION_KEY); private final System2 system2; diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/live/LiveMeasureComputerImpl.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/live/LiveMeasureComputerImpl.java index 96c6a7a3968..643f5335f54 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/live/LiveMeasureComputerImpl.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/live/LiveMeasureComputerImpl.java @@ -29,7 +29,7 @@ import java.util.Set; import javax.annotation.CheckForNull; import org.sonar.api.config.Configuration; import org.sonar.api.measures.Metric; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.LoggerFactory; import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.db.component.BranchDto; @@ -134,7 +134,7 @@ public class LiveMeasureComputerImpl implements LiveMeasureComputer { try { return Metric.Level.valueOf(measure.get().getTextValue()); } catch (IllegalArgumentException e) { - Loggers.get(LiveMeasureComputerImpl.class).trace("Failed to parse value of metric '{}'", ALERT_STATUS_KEY, e); + LoggerFactory.getLogger(LiveMeasureComputerImpl.class).trace("Failed to parse value of metric '{}'", ALERT_STATUS_KEY, e); return null; } } diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/notification/ws/NotificationCenter.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/notification/ws/NotificationCenter.java index 8cb4ce535db..10023f09c03 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/notification/ws/NotificationCenter.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/notification/ws/NotificationCenter.java @@ -24,14 +24,14 @@ import java.util.Arrays; import java.util.List; import javax.annotation.Nullable; import org.sonar.api.notifications.NotificationChannel; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.server.notification.NotificationDispatcherMetadata; import org.springframework.beans.factory.annotation.Autowired; public class NotificationCenter { - private static final Logger LOG = Loggers.get(NotificationCenter.class); + private static final Logger LOG = LoggerFactory.getLogger(NotificationCenter.class); private final NotificationDispatcherMetadata[] dispatchersMetadata; private final NotificationChannel[] channels; diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/platform/ws/ChangeLogLevelClusterService.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/platform/ws/ChangeLogLevelClusterService.java index 946b7335bb5..3a88db4131e 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/platform/ws/ChangeLogLevelClusterService.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/platform/ws/ChangeLogLevelClusterService.java @@ -20,9 +20,9 @@ package org.sonar.server.platform.ws; import javax.annotation.Nullable; -import org.sonar.api.utils.log.Logger; +import org.slf4j.Logger; import org.sonar.api.utils.log.LoggerLevel; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.LoggerFactory; import org.sonar.process.ProcessId; import org.sonar.process.cluster.hz.DistributedCall; import org.sonar.process.cluster.hz.HazelcastMember; @@ -32,7 +32,7 @@ import org.sonar.server.log.ServerLogging; public class ChangeLogLevelClusterService implements ChangeLogLevelService { private static final long CLUSTER_TIMEOUT_MILLIS = 5000; - private static final Logger LOGGER = Loggers.get(ChangeLogLevelClusterService.class); + private static final Logger LOGGER = LoggerFactory.getLogger(ChangeLogLevelClusterService.class); private final HazelcastMember member; diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/platform/ws/RestartAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/platform/ws/RestartAction.java index 93579ca7bc3..87bade69dad 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/platform/ws/RestartAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/platform/ws/RestartAction.java @@ -22,8 +22,8 @@ package org.sonar.server.platform.ws; import org.sonar.api.server.ws.Request; import org.sonar.api.server.ws.Response; import org.sonar.api.server.ws.WebService; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.server.app.ProcessCommandWrapper; import org.sonar.server.app.RestartFlagHolder; import org.sonar.server.platform.NodeInformation; @@ -34,7 +34,7 @@ import org.sonar.server.user.UserSession; */ public class RestartAction implements SystemWsAction { - private static final Logger LOGGER = Loggers.get(RestartAction.class); + private static final Logger LOGGER = LoggerFactory.getLogger(RestartAction.class); private final UserSession userSession; private final ProcessCommandWrapper processCommandWrapper; diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/projectanalysis/ws/SearchResponseBuilder.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/projectanalysis/ws/SearchResponseBuilder.java index dcfb1981458..83d2da299ec 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/projectanalysis/ws/SearchResponseBuilder.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/projectanalysis/ws/SearchResponseBuilder.java @@ -28,8 +28,8 @@ import java.util.List; import java.util.Optional; import java.util.stream.Collectors; import javax.annotation.Nullable; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.db.component.SnapshotDto; import org.sonar.db.event.EventComponentChangeDto; import org.sonar.db.event.EventDto; @@ -46,7 +46,7 @@ import static org.sonar.core.util.stream.MoreCollectors.index; import static org.sonar.server.projectanalysis.ws.EventCategory.fromLabel; class SearchResponseBuilder { - private static final Logger LOGGER = Loggers.get(SearchResponseBuilder.class); + private static final Logger LOGGER = LoggerFactory.getLogger(SearchResponseBuilder.class); private final Analysis.Builder wsAnalysis; private final Event.Builder wsEvent; diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/source/HtmlTextDecorator.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/source/HtmlTextDecorator.java index ce29a9fc214..47fc1f4f981 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/source/HtmlTextDecorator.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/source/HtmlTextDecorator.java @@ -26,7 +26,7 @@ import java.io.StringReader; import java.util.Collection; import java.util.List; import javax.annotation.Nullable; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.LoggerFactory; import static com.google.common.collect.Lists.newArrayList; @@ -83,7 +83,7 @@ class HtmlTextDecorator { } catch (IOException exception) { String errorMsg = "An exception occurred while highlighting the syntax of one of the project's files"; - Loggers.get(HtmlTextDecorator.class).error(errorMsg); + LoggerFactory.getLogger(HtmlTextDecorator.class).error(errorMsg); throw new IllegalStateException(errorMsg, exception); } finally { Closeables.closeQuietly(stringBuffer); diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/user/ws/ChangePasswordAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/user/ws/ChangePasswordAction.java index accc04598a5..84ba5756853 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/user/ws/ChangePasswordAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/user/ws/ChangePasswordAction.java @@ -29,8 +29,8 @@ import org.sonar.api.server.http.HttpRequest; import org.sonar.api.server.http.HttpResponse; import org.sonar.api.server.ws.Change; import org.sonar.api.server.ws.WebService; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.api.web.FilterChain; import org.sonar.api.web.HttpFilter; import org.sonar.api.web.UrlPattern; @@ -62,7 +62,7 @@ import static org.sonarqube.ws.client.user.UsersWsParameters.PARAM_PREVIOUS_PASS public class ChangePasswordAction extends HttpFilter implements BaseUsersWsAction { - private static final Logger LOG = Loggers.get(ChangePasswordAction.class); + private static final Logger LOG = LoggerFactory.getLogger(ChangePasswordAction.class); private static final String CHANGE_PASSWORD = "change_password"; private static final String CHANGE_PASSWORD_URL = "/" + UsersWs.API_USERS + "/" + CHANGE_PASSWORD; diff --git a/server/sonar-webserver-ws/src/main/java/org/sonar/server/ws/ServletRequest.java b/server/sonar-webserver-ws/src/main/java/org/sonar/server/ws/ServletRequest.java index 79b7bdbf156..a661c6005f4 100644 --- a/server/sonar-webserver-ws/src/main/java/org/sonar/server/ws/ServletRequest.java +++ b/server/sonar-webserver-ws/src/main/java/org/sonar/server/ws/ServletRequest.java @@ -35,7 +35,7 @@ import javax.servlet.http.HttpServletRequest; import org.sonar.api.impl.ws.PartImpl; import org.sonar.api.impl.ws.ValidatingRequest; import org.sonar.api.server.http.HttpRequest; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.LoggerFactory; import org.sonar.server.http.JavaxHttpRequest; import org.sonarqube.ws.MediaTypes; @@ -120,7 +120,7 @@ public class ServletRequest extends ValidatingRequest { } return new PartImpl(part.getInputStream(), part.getSubmittedFileName()); } catch (Exception e) { - Loggers.get(ServletRequest.class).warn("Can't read file part for parameter " + key, e); + LoggerFactory.getLogger(ServletRequest.class).warn("Can't read file part for parameter " + key, e); return null; } } diff --git a/server/sonar-webserver-ws/src/main/java/org/sonar/server/ws/WebServiceEngine.java b/server/sonar-webserver-ws/src/main/java/org/sonar/server/ws/WebServiceEngine.java index da04ef94fdd..e36c6430171 100644 --- a/server/sonar-webserver-ws/src/main/java/org/sonar/server/ws/WebServiceEngine.java +++ b/server/sonar-webserver-ws/src/main/java/org/sonar/server/ws/WebServiceEngine.java @@ -34,8 +34,8 @@ import org.sonar.api.server.ws.LocalConnector; import org.sonar.api.server.ws.Request; import org.sonar.api.server.ws.Response; import org.sonar.api.server.ws.WebService; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.api.utils.text.JsonWriter; import org.sonar.server.exceptions.BadConfigurationException; import org.sonar.server.exceptions.BadRequestException; @@ -59,7 +59,7 @@ import static org.sonar.server.ws.ServletRequest.SUPPORTED_MEDIA_TYPES_BY_URL_SU @ServerSide public class WebServiceEngine implements LocalConnector, Startable { - private static final Logger LOGGER = Loggers.get(WebServiceEngine.class); + private static final Logger LOGGER = LoggerFactory.getLogger(WebServiceEngine.class); private final WebService[] webServices; diff --git a/server/sonar-webserver/src/main/java/org/sonar/server/app/EmbeddedTomcat.java b/server/sonar-webserver/src/main/java/org/sonar/server/app/EmbeddedTomcat.java index 91596edbe7c..5173c52e16b 100644 --- a/server/sonar-webserver/src/main/java/org/sonar/server/app/EmbeddedTomcat.java +++ b/server/sonar-webserver/src/main/java/org/sonar/server/app/EmbeddedTomcat.java @@ -28,7 +28,6 @@ import org.apache.catalina.LifecycleException; import org.apache.catalina.core.StandardContext; import org.apache.catalina.startup.Tomcat; import org.slf4j.LoggerFactory; -import org.sonar.api.utils.log.Loggers; import org.sonar.process.Props; import static org.sonar.core.util.FileUtils.deleteQuietly; @@ -71,9 +70,9 @@ class EmbeddedTomcat { logger.setLevel(Level.ERROR); tomcat.start(); logger.setLevel(Level.OFF); - new TomcatStartupLogs(Loggers.get(getClass())).log(tomcat); + new TomcatStartupLogs(LoggerFactory.getLogger(getClass())).log(tomcat); } catch (LifecycleException e) { - Loggers.get(EmbeddedTomcat.class).error("Fail to start web server", e); + LoggerFactory.getLogger(EmbeddedTomcat.class).error("Fail to start web server", e); Throwables.propagate(e); } } @@ -106,7 +105,7 @@ class EmbeddedTomcat { tomcat.stop(); tomcat.destroy(); } catch (Exception e) { - Loggers.get(EmbeddedTomcat.class).warn("Failed to stop web server", e); + LoggerFactory.getLogger(EmbeddedTomcat.class).warn("Failed to stop web server", e); } } deleteQuietly(tomcatBasedir()); diff --git a/server/sonar-webserver/src/main/java/org/sonar/server/app/TomcatAccessLog.java b/server/sonar-webserver/src/main/java/org/sonar/server/app/TomcatAccessLog.java index 23e9ca527c5..60a9bdf7621 100644 --- a/server/sonar-webserver/src/main/java/org/sonar/server/app/TomcatAccessLog.java +++ b/server/sonar-webserver/src/main/java/org/sonar/server/app/TomcatAccessLog.java @@ -24,8 +24,8 @@ import ch.qos.logback.core.FileAppender; import org.apache.catalina.LifecycleEvent; import org.apache.catalina.LifecycleListener; import org.apache.catalina.startup.Tomcat; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.process.logging.LogbackHelper; import org.sonar.process.Props; @@ -37,7 +37,7 @@ class TomcatAccessLog { void configure(Tomcat tomcat, Props props) { tomcat.setSilent(true); - tomcat.getService().addLifecycleListener(new LifecycleLogger(Loggers.get(TomcatAccessLog.class))); + tomcat.getService().addLifecycleListener(new LifecycleLogger(LoggerFactory.getLogger(TomcatAccessLog.class))); configureLogbackAccess(tomcat, props); } diff --git a/server/sonar-webserver/src/main/java/org/sonar/server/app/TomcatStartupLogs.java b/server/sonar-webserver/src/main/java/org/sonar/server/app/TomcatStartupLogs.java index 7b37fbddb7d..0fc545e88e0 100644 --- a/server/sonar-webserver/src/main/java/org/sonar/server/app/TomcatStartupLogs.java +++ b/server/sonar-webserver/src/main/java/org/sonar/server/app/TomcatStartupLogs.java @@ -22,7 +22,7 @@ package org.sonar.server.app; import org.apache.catalina.connector.Connector; import org.apache.catalina.startup.Tomcat; import org.apache.commons.lang.StringUtils; -import org.sonar.api.utils.log.Logger; +import org.slf4j.Logger; class TomcatStartupLogs { diff --git a/server/sonar-webserver/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevelStartup.java b/server/sonar-webserver/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevelStartup.java index 608d841b13a..3cd30ccb4c3 100644 --- a/server/sonar-webserver/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevelStartup.java +++ b/server/sonar-webserver/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevelStartup.java @@ -19,7 +19,7 @@ */ package org.sonar.server.platform.platformlevel; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.LoggerFactory; import org.sonar.core.platform.EditionProvider; import org.sonar.core.platform.PlatformEditionProvider; import org.sonar.server.app.ProcessCommandWrapper; @@ -131,7 +131,7 @@ public class PlatformLevelStartup extends PlatformLevel { get(ServerLifecycleNotifier.class).notifyStart(); get(ProcessCommandWrapper.class).notifyOperational(); get(WebServerRuleFinder.class).stopCaching(); - Loggers.get(PlatformLevelStartup.class) + LoggerFactory.getLogger(PlatformLevelStartup.class) .info("Running {} Edition", get(PlatformEditionProvider.class).get().map(EditionProvider.Edition::getLabel).orElse("")); get(DefaultAdminCredentialsVerifierImpl.class).runAtStart(); } diff --git a/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/MasterServletFilter.java b/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/MasterServletFilter.java index 31e40cf4b2b..ebde1c2c72f 100644 --- a/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/MasterServletFilter.java +++ b/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/MasterServletFilter.java @@ -36,9 +36,10 @@ import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.slf4j.Logger; import org.sonar.api.server.http.HttpRequest; import org.sonar.api.server.http.HttpResponse; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.LoggerFactory; import org.sonar.api.web.HttpFilter; import org.sonar.api.web.ServletFilter; import org.sonar.server.http.JavaxHttpRequest; @@ -51,6 +52,7 @@ import org.sonar.server.platform.PlatformImpl; public class MasterServletFilter implements Filter { private static final String SCIM_FILTER_PATH = "/api/scim/v2/"; + private static final Logger LOG = LoggerFactory.getLogger(MasterServletFilter.class); private static volatile MasterServletFilter instance; @Deprecated(forRemoval = true) @@ -94,7 +96,7 @@ public class MasterServletFilter implements Filter { LinkedList<HttpFilter> filterList = new LinkedList<>(); for (HttpFilter extension : filterExtensions) { try { - Loggers.get(MasterServletFilter.class).info(String.format("Initializing servlet filter %s [pattern=%s]", extension, extension.doGetPattern().label())); + LOG.info(String.format("Initializing servlet filter %s [pattern=%s]", extension, extension.doGetPattern().label())); extension.init(); // As for scim we need to intercept traffic to URLs with path parameters // and that use is not properly handled when dealing with inclusions/exclusions of the WebServiceFilter, @@ -121,7 +123,7 @@ public class MasterServletFilter implements Filter { LinkedList<ServletFilter> filterList = new LinkedList<>(); for (ServletFilter extension : filterExtensions) { try { - Loggers.get(MasterServletFilter.class).info(String.format("Initializing servlet filter %s [pattern=%s]", extension, extension.doGetPattern().label())); + LOG.info(String.format("Initializing servlet filter %s [pattern=%s]", extension, extension.doGetPattern().label())); extension.init(config); // adding deprecated extensions as last filterList.addLast(extension); diff --git a/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/PlatformServletContextListener.java b/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/PlatformServletContextListener.java index 061f50b9af5..b106c69f900 100644 --- a/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/PlatformServletContextListener.java +++ b/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/PlatformServletContextListener.java @@ -24,11 +24,13 @@ import java.util.Properties; import javax.servlet.ServletContext; import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextListener; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.server.platform.PlatformImpl; public final class PlatformServletContextListener implements ServletContextListener { static final String STARTED_ATTRIBUTE = "sonarqube.started"; + private static final Logger LOG = LoggerFactory.getLogger(PlatformServletContextListener.class); @Override public void contextInitialized(ServletContextEvent event) { @@ -44,10 +46,10 @@ public final class PlatformServletContextListener implements ServletContextListe PlatformImpl.getInstance().doStart(); event.getServletContext().setAttribute(STARTED_ATTRIBUTE, Boolean.TRUE); } catch (org.sonar.api.utils.MessageException | org.sonar.process.MessageException e) { - Loggers.get(PlatformImpl.class).error("Web server startup failed: " + e.getMessage()); + LOG.error("Web server startup failed: {}", e.getMessage()); stopQuietly(); } catch (Throwable t) { - Loggers.get(PlatformImpl.class).error("Web server startup failed", t); + LOG.error("Web server startup failed", t); stopQuietly(); throw new AbortTomcatStartException(); } diff --git a/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/StaticResourcesServlet.java b/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/StaticResourcesServlet.java index 303f8ca88fa..453a3dee0e3 100644 --- a/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/StaticResourcesServlet.java +++ b/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/StaticResourcesServlet.java @@ -30,8 +30,8 @@ import javax.servlet.http.HttpServletResponse; import org.apache.catalina.connector.ClientAbortException; import org.apache.commons.io.IOUtils; import org.apache.commons.lang.StringUtils; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.core.platform.PluginRepository; import org.sonar.core.extension.CoreExtensionRepository; import org.sonar.server.platform.PlatformImpl; @@ -43,7 +43,7 @@ import static javax.servlet.http.HttpServletResponse.SC_NOT_FOUND; public class StaticResourcesServlet extends HttpServlet { - private static final Logger LOG = Loggers.get(StaticResourcesServlet.class); + private static final Logger LOG = LoggerFactory.getLogger(StaticResourcesServlet.class); private static final long serialVersionUID = -2577454614650178426L; private final System system; diff --git a/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/UserSessionFilter.java b/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/UserSessionFilter.java index 104bc7d87aa..c7e9e88004c 100644 --- a/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/UserSessionFilter.java +++ b/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/UserSessionFilter.java @@ -30,8 +30,8 @@ import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.db.DBSessions; import org.sonar.server.authentication.UserSessionInitializer; import org.sonar.server.http.JavaxHttpRequest; @@ -41,7 +41,7 @@ import org.sonar.server.platform.PlatformImpl; import org.sonar.server.setting.ThreadLocalSettings; public class UserSessionFilter implements Filter { - private static final Logger LOG = Loggers.get(UserSessionFilter.class); + private static final Logger LOG = LoggerFactory.getLogger(UserSessionFilter.class); private final Platform platform; public UserSessionFilter() { diff --git a/server/sonar-webserver/src/test/java/org/sonar/server/app/StartupLogsTest.java b/server/sonar-webserver/src/test/java/org/sonar/server/app/StartupLogsTest.java index 82985d18ed4..412dc7640af 100644 --- a/server/sonar-webserver/src/test/java/org/sonar/server/app/StartupLogsTest.java +++ b/server/sonar-webserver/src/test/java/org/sonar/server/app/StartupLogsTest.java @@ -23,7 +23,7 @@ import org.apache.catalina.connector.Connector; import org.apache.catalina.startup.Tomcat; import org.junit.Test; import org.mockito.Mockito; -import org.sonar.api.utils.log.Logger; +import org.slf4j.Logger; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.Assert.fail; diff --git a/server/sonar-webserver/src/test/java/org/sonar/server/app/TomcatAccessLogTest.java b/server/sonar-webserver/src/test/java/org/sonar/server/app/TomcatAccessLogTest.java index ace687ae28a..48c249e4e1b 100644 --- a/server/sonar-webserver/src/test/java/org/sonar/server/app/TomcatAccessLogTest.java +++ b/server/sonar-webserver/src/test/java/org/sonar/server/app/TomcatAccessLogTest.java @@ -30,7 +30,7 @@ import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; import org.mockito.Mockito; -import org.sonar.api.utils.log.Logger; +import org.slf4j.Logger; import org.sonar.process.Props; import static org.mockito.Mockito.any; diff --git a/sonar-application/src/main/java/org/sonar/application/App.java b/sonar-application/src/main/java/org/sonar/application/App.java index 3d3e78b46ac..df601ab1b91 100644 --- a/sonar-application/src/main/java/org/sonar/application/App.java +++ b/sonar-application/src/main/java/org/sonar/application/App.java @@ -19,7 +19,7 @@ */ package org.sonar.application; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.LoggerFactory; import org.sonar.application.command.CommandFactory; import org.sonar.application.command.CommandFactoryImpl; import org.sonar.application.config.AppSettings; @@ -71,7 +71,7 @@ public class App { hardStopRequestWatcher.stopWatching(); } } catch (Exception e) { - Loggers.get(App.class).error("Startup failure", e); + LoggerFactory.getLogger(App.class).error("Startup failure", e); } systemExit.exit(0); diff --git a/sonar-core/src/main/java/org/sonar/core/extension/CoreExtensionsInstaller.java b/sonar-core/src/main/java/org/sonar/core/extension/CoreExtensionsInstaller.java index 5376e9b676a..d9f8c96296c 100644 --- a/sonar-core/src/main/java/org/sonar/core/extension/CoreExtensionsInstaller.java +++ b/sonar-core/src/main/java/org/sonar/core/extension/CoreExtensionsInstaller.java @@ -28,14 +28,14 @@ import org.sonar.api.SonarRuntime; import org.sonar.api.config.Configuration; import org.sonar.api.config.internal.MapSettings; import org.sonar.api.utils.AnnotationUtils; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.core.platform.ExtensionContainer; import static java.util.Objects.requireNonNull; public abstract class CoreExtensionsInstaller { - private static final Logger LOG = Loggers.get(CoreExtensionsInstaller.class); + private static final Logger LOG = LoggerFactory.getLogger(CoreExtensionsInstaller.class); private final SonarRuntime sonarRuntime; private final CoreExtensionRepository coreExtensionRepository; diff --git a/sonar-core/src/main/java/org/sonar/core/extension/CoreExtensionsLoader.java b/sonar-core/src/main/java/org/sonar/core/extension/CoreExtensionsLoader.java index b1788bfa8eb..4ff57667607 100644 --- a/sonar-core/src/main/java/org/sonar/core/extension/CoreExtensionsLoader.java +++ b/sonar-core/src/main/java/org/sonar/core/extension/CoreExtensionsLoader.java @@ -23,8 +23,8 @@ import java.util.Map; import java.util.Set; import java.util.stream.Collectors; import javax.inject.Inject; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.core.util.stream.MoreCollectors; import static com.google.common.base.Preconditions.checkState; @@ -33,7 +33,7 @@ import static com.google.common.base.Preconditions.checkState; * Load {@link CoreExtension} and register them into the {@link CoreExtensionRepository}. */ public class CoreExtensionsLoader { - private static final Logger LOG = Loggers.get(CoreExtensionsLoader.class); + private static final Logger LOG = LoggerFactory.getLogger(CoreExtensionsLoader.class); private final CoreExtensionRepository coreExtensionRepository; private final ServiceLoaderWrapper serviceLoaderWrapper; diff --git a/sonar-core/src/main/java/org/sonar/core/i18n/DefaultI18n.java b/sonar-core/src/main/java/org/sonar/core/i18n/DefaultI18n.java index 37e25d4a7bb..d4acff8aef9 100644 --- a/sonar-core/src/main/java/org/sonar/core/i18n/DefaultI18n.java +++ b/sonar-core/src/main/java/org/sonar/core/i18n/DefaultI18n.java @@ -43,8 +43,8 @@ import org.apache.commons.io.IOUtils; import org.sonar.api.Startable; import org.sonar.api.utils.SonarException; import org.sonar.api.utils.System2; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.core.platform.PluginInfo; import org.sonar.core.platform.PluginRepository; @@ -52,7 +52,7 @@ import static java.nio.charset.StandardCharsets.UTF_8; public class DefaultI18n implements I18n, Startable { - private static final Logger LOG = Loggers.get(DefaultI18n.class); + private static final Logger LOG = LoggerFactory.getLogger(DefaultI18n.class); private static final String BUNDLE_PACKAGE = "org.sonar.l10n."; private final PluginRepository pluginRepository; diff --git a/sonar-core/src/main/java/org/sonar/core/platform/ComponentKeys.java b/sonar-core/src/main/java/org/sonar/core/platform/ComponentKeys.java index 5f3c5d0d012..48cb5b0b5e2 100644 --- a/sonar-core/src/main/java/org/sonar/core/platform/ComponentKeys.java +++ b/sonar-core/src/main/java/org/sonar/core/platform/ComponentKeys.java @@ -23,11 +23,11 @@ import java.util.HashSet; import java.util.Set; import java.util.regex.Pattern; import org.sonar.core.util.Uuids; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class ComponentKeys { - private static final Logger LOG = Loggers.get(ComponentKeys.class); + private static final Logger LOG = LoggerFactory.getLogger(ComponentKeys.class); private static final Pattern IDENTITY_HASH_PATTERN = Pattern.compile(".+@[a-f0-9]+"); private final Set<Class> objectsWithoutToString = new HashSet<>(); diff --git a/sonar-core/src/main/java/org/sonar/core/platform/PluginClassLoader.java b/sonar-core/src/main/java/org/sonar/core/platform/PluginClassLoader.java index 0937d119ad0..0da6c64a26c 100644 --- a/sonar-core/src/main/java/org/sonar/core/platform/PluginClassLoader.java +++ b/sonar-core/src/main/java/org/sonar/core/platform/PluginClassLoader.java @@ -28,7 +28,7 @@ import java.util.Map; import java.util.stream.Collectors; import org.apache.commons.lang.SystemUtils; import org.sonar.api.Plugin; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.LoggerFactory; import org.sonar.updatecenter.common.Version; import static java.util.Collections.singleton; @@ -95,13 +95,13 @@ public class PluginClassLoader { // They can't change metadata like ordering strategy or compatibility mode. if (Strings.isNullOrEmpty(info.getBasePlugin())) { if (info.isUseChildFirstClassLoader()) { - Loggers.get(getClass()).warn("Plugin {} [{}] uses a child first classloader which is deprecated", info.getName(), info.getKey()); + LoggerFactory.getLogger(getClass()).warn("Plugin {} [{}] uses a child first classloader which is deprecated", info.getName(), info.getKey()); } def.setSelfFirstStrategy(info.isUseChildFirstClassLoader()); Version minSonarPluginApiVersion = info.getMinimalSonarPluginApiVersion(); boolean compatibilityMode = minSonarPluginApiVersion != null && minSonarPluginApiVersion.compareToIgnoreQualifier(COMPATIBILITY_MODE_MAX_VERSION) < 0; if (compatibilityMode) { - Loggers.get(getClass()).warn("API compatibility mode is no longer supported. In case of error, plugin {} [{}] should package its dependencies.", + LoggerFactory.getLogger(getClass()).warn("API compatibility mode is no longer supported. In case of error, plugin {} [{}] should package its dependencies.", info.getName(), info.getKey()); } } @@ -146,7 +146,7 @@ public class PluginClassLoader { try { ((Closeable) classLoader).close(); } catch (Exception e) { - Loggers.get(getClass()).error("Fail to close classloader " + classLoader.toString(), e); + LoggerFactory.getLogger(getClass()).error("Fail to close classloader " + classLoader.toString(), e); } } } diff --git a/sonar-core/src/main/java/org/sonar/core/platform/PluginInfo.java b/sonar-core/src/main/java/org/sonar/core/platform/PluginInfo.java index e0d91e48197..ba2616b7860 100644 --- a/sonar-core/src/main/java/org/sonar/core/platform/PluginInfo.java +++ b/sonar-core/src/main/java/org/sonar/core/platform/PluginInfo.java @@ -37,15 +37,15 @@ import javax.annotation.CheckForNull; import javax.annotation.Nullable; import org.apache.commons.lang.StringUtils; import org.sonar.api.utils.MessageException; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.updatecenter.common.PluginManifest; import org.sonar.updatecenter.common.Version; import static java.util.Objects.requireNonNull; public class PluginInfo implements Comparable<PluginInfo> { - private static final Logger LOGGER = Loggers.get(PluginInfo.class); + private static final Logger LOGGER = LoggerFactory.getLogger(PluginInfo.class); private static final Joiner SLASH_JOINER = Joiner.on(" / ").skipNulls(); diff --git a/sonar-core/src/main/java/org/sonar/core/platform/StartableBeanPostProcessor.java b/sonar-core/src/main/java/org/sonar/core/platform/StartableBeanPostProcessor.java index db00c617608..e2d25d8e1ee 100644 --- a/sonar-core/src/main/java/org/sonar/core/platform/StartableBeanPostProcessor.java +++ b/sonar-core/src/main/java/org/sonar/core/platform/StartableBeanPostProcessor.java @@ -20,7 +20,7 @@ package org.sonar.core.platform; import org.sonar.api.Startable; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.LoggerFactory; import org.springframework.beans.BeansException; import org.springframework.beans.factory.config.DestructionAwareBeanPostProcessor; import org.springframework.lang.Nullable; @@ -48,7 +48,7 @@ public class StartableBeanPostProcessor implements DestructionAwareBeanPostProce ((Startable) bean).stop(); } } catch (Exception e) { - Loggers.get(StartableBeanPostProcessor.class) + LoggerFactory.getLogger(StartableBeanPostProcessor.class) .warn("Dispose of component {} failed", bean.getClass().getCanonicalName(), e); } } diff --git a/sonar-core/src/main/java/org/sonar/core/util/DefaultHttpDownloader.java b/sonar-core/src/main/java/org/sonar/core/util/DefaultHttpDownloader.java index 85c56de88be..a61aeb5dc5a 100644 --- a/sonar-core/src/main/java/org/sonar/core/util/DefaultHttpDownloader.java +++ b/sonar-core/src/main/java/org/sonar/core/util/DefaultHttpDownloader.java @@ -42,12 +42,13 @@ import javax.annotation.Nullable; import javax.inject.Inject; import org.apache.commons.codec.binary.Base64; import org.apache.commons.io.IOUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.api.CoreProperties; import org.sonar.api.config.Configuration; import org.sonar.api.platform.Server; import org.sonar.api.utils.HttpDownloader; import org.sonar.api.utils.SonarException; -import org.sonar.api.utils.log.Loggers; import static org.apache.commons.io.FileUtils.copyInputStreamToFile; import static org.sonar.core.util.FileUtils.deleteQuietly; @@ -59,6 +60,7 @@ import static org.sonar.core.util.FileUtils.deleteQuietly; */ public class DefaultHttpDownloader extends HttpDownloader { + private static final Logger LOG = LoggerFactory.getLogger(DefaultHttpDownloader.class); private final BaseHttpDownloader downloader; private final Integer readTimeout; private final Integer connectTimeout; @@ -253,7 +255,7 @@ public class DefaultHttpDownloader extends HttpDownloader { * @throws HttpException if HTTP response code > 400 */ public InputStream getInput() throws IOException { - Loggers.get(getClass()).debug("Download: " + uri + " (" + getProxySynthesis(uri, ProxySelector.getDefault()) + ")"); + LOG.debug("Download: {}} ( {} )", uri, getProxySynthesis(uri, ProxySelector.getDefault())); HttpURLConnection connection = (HttpURLConnection) uri.toURL().openConnection(); connection.setRequestMethod(requestMethod); HttpsTrust.INSTANCE.trust(connection); diff --git a/sonar-core/src/main/java/org/sonar/core/util/MacAddressProvider.java b/sonar-core/src/main/java/org/sonar/core/util/MacAddressProvider.java index bce52c68eee..c0a1bb7930f 100644 --- a/sonar-core/src/main/java/org/sonar/core/util/MacAddressProvider.java +++ b/sonar-core/src/main/java/org/sonar/core/util/MacAddressProvider.java @@ -26,15 +26,15 @@ import java.security.SecureRandom; import java.util.Enumeration; import javax.annotation.CheckForNull; import javax.annotation.Nullable; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Used by {@link UuidFactoryImpl}. Heavily inspired by https://github.com/elastic/elasticsearch/blob/master/core/src/main/java/org/elasticsearch/common/MacAddressProvider.java */ class MacAddressProvider { - private static final Logger LOGGER = Loggers.get(MacAddressProvider.class); + private static final Logger LOGGER = LoggerFactory.getLogger(MacAddressProvider.class); public static final int BYTE_SIZE = 6; private MacAddressProvider() { diff --git a/sonar-core/src/main/java/org/sonar/core/util/ProgressLogger.java b/sonar-core/src/main/java/org/sonar/core/util/ProgressLogger.java index b909b236398..eb1e9de9a32 100644 --- a/sonar-core/src/main/java/org/sonar/core/util/ProgressLogger.java +++ b/sonar-core/src/main/java/org/sonar/core/util/ProgressLogger.java @@ -22,8 +22,8 @@ package org.sonar.core.util; import java.util.Timer; import java.util.TimerTask; import java.util.concurrent.atomic.AtomicLong; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Background thread that logs the state of a counter at fixed intervals. @@ -43,7 +43,7 @@ public class ProgressLogger { public static ProgressLogger create(Class clazz, AtomicLong counter) { String threadName = String.format("ProgressLogger[%s]", clazz.getSimpleName()); - Logger logger = Loggers.get(clazz); + Logger logger = LoggerFactory.getLogger(clazz); return new ProgressLogger(threadName, counter, logger); } diff --git a/sonar-core/src/main/java/org/sonar/core/util/logs/DefaultProfiler.java b/sonar-core/src/main/java/org/sonar/core/util/logs/DefaultProfiler.java index 1f70143f758..10689e92839 100644 --- a/sonar-core/src/main/java/org/sonar/core/util/logs/DefaultProfiler.java +++ b/sonar-core/src/main/java/org/sonar/core/util/logs/DefaultProfiler.java @@ -24,7 +24,7 @@ import java.util.Map; import javax.annotation.Nullable; import org.apache.commons.lang.StringUtils; import org.sonar.api.utils.System2; -import org.sonar.api.utils.log.Logger; +import org.slf4j.Logger; import org.sonar.api.utils.log.LoggerLevel; class DefaultProfiler extends Profiler { diff --git a/sonar-core/src/main/java/org/sonar/core/util/logs/Profiler.java b/sonar-core/src/main/java/org/sonar/core/util/logs/Profiler.java index ce593c3b138..567e9b27243 100644 --- a/sonar-core/src/main/java/org/sonar/core/util/logs/Profiler.java +++ b/sonar-core/src/main/java/org/sonar/core/util/logs/Profiler.java @@ -20,7 +20,7 @@ package org.sonar.core.util.logs; import javax.annotation.Nullable; -import org.sonar.api.utils.log.Logger; +import org.slf4j.Logger; /** * diff --git a/sonar-core/src/test/java/org/sonar/core/platform/ComponentKeysTest.java b/sonar-core/src/test/java/org/sonar/core/platform/ComponentKeysTest.java index 74e6326b7cb..360402b128e 100644 --- a/sonar-core/src/test/java/org/sonar/core/platform/ComponentKeysTest.java +++ b/sonar-core/src/test/java/org/sonar/core/platform/ComponentKeysTest.java @@ -20,7 +20,7 @@ package org.sonar.core.platform; import org.junit.Test; -import org.sonar.api.utils.log.Logger; +import org.slf4j.Logger; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.startsWith; diff --git a/sonar-core/src/test/java/org/sonar/core/util/ProgressLoggerTest.java b/sonar-core/src/test/java/org/sonar/core/util/ProgressLoggerTest.java index d4ca9389040..a8978abaa96 100644 --- a/sonar-core/src/test/java/org/sonar/core/util/ProgressLoggerTest.java +++ b/sonar-core/src/test/java/org/sonar/core/util/ProgressLoggerTest.java @@ -26,7 +26,7 @@ import org.junit.Rule; import org.junit.Test; import org.slf4j.event.Level; import org.sonar.api.testfixtures.log.LogTester; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.LoggerFactory; import static org.assertj.core.api.Assertions.assertThat; @@ -38,7 +38,7 @@ public class ProgressLoggerTest { @Test(timeout = 5_000L) public void log_at_fixed_intervals() { AtomicLong counter = new AtomicLong(42L); - ProgressLogger progress = new ProgressLogger("ProgressLoggerTest", counter, Loggers.get(getClass())); + ProgressLogger progress = new ProgressLogger("ProgressLoggerTest", counter, LoggerFactory.getLogger(getClass())); progress.setPeriodMs(1L); progress.start(); while (logTester.logs(Level.INFO).size()<2) { diff --git a/sonar-core/src/test/java/org/sonar/core/util/logs/DefaultProfilerTest.java b/sonar-core/src/test/java/org/sonar/core/util/logs/DefaultProfilerTest.java index f88bd0ee4f2..a4b58a618b7 100644 --- a/sonar-core/src/test/java/org/sonar/core/util/logs/DefaultProfilerTest.java +++ b/sonar-core/src/test/java/org/sonar/core/util/logs/DefaultProfilerTest.java @@ -29,7 +29,7 @@ import org.junit.runner.RunWith; import org.slf4j.event.Level; import org.sonar.api.testfixtures.log.LogTester; import org.sonar.api.utils.log.LoggerLevel; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.LoggerFactory; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.Assert.fail; @@ -40,7 +40,7 @@ public class DefaultProfilerTest { @Rule public LogTester tester = new LogTester(); - Profiler underTest = Profiler.create(Loggers.get("DefaultProfilerTest")); + Profiler underTest = Profiler.create(LoggerFactory.getLogger("DefaultProfilerTest")); @DataProvider public static Object[][] logTimeLastValues() { diff --git a/sonar-core/src/test/java/org/sonar/core/util/logs/ProfilerTest.java b/sonar-core/src/test/java/org/sonar/core/util/logs/ProfilerTest.java index c1a5e5999db..a9a524f18b5 100644 --- a/sonar-core/src/test/java/org/sonar/core/util/logs/ProfilerTest.java +++ b/sonar-core/src/test/java/org/sonar/core/util/logs/ProfilerTest.java @@ -23,7 +23,7 @@ import org.junit.Rule; import org.junit.Test; import org.sonar.api.testfixtures.log.LogTester; import org.sonar.api.utils.log.LoggerLevel; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.LoggerFactory; import static org.assertj.core.api.Assertions.assertThat; @@ -33,29 +33,29 @@ public class ProfilerTest { @Test public void create() { - Profiler profiler = Profiler.create(Loggers.get("foo")); + Profiler profiler = Profiler.create(LoggerFactory.getLogger("foo")); assertThat(profiler).isInstanceOf(DefaultProfiler.class); } @Test public void create_null_profiler_if_trace_level_is_disabled() { tester.setLevel(LoggerLevel.TRACE); - Profiler profiler = Profiler.createIfTrace(Loggers.get("foo")); + Profiler profiler = Profiler.createIfTrace(LoggerFactory.getLogger("foo")); assertThat(profiler).isInstanceOf(DefaultProfiler.class); tester.setLevel(LoggerLevel.DEBUG); - profiler = Profiler.createIfTrace(Loggers.get("foo")); + profiler = Profiler.createIfTrace(LoggerFactory.getLogger("foo")); assertThat(profiler).isInstanceOf(NullProfiler.class); } @Test public void create_null_profiler_if_debug_level_is_disabled() { tester.setLevel(LoggerLevel.TRACE); - Profiler profiler = Profiler.createIfDebug(Loggers.get("foo")); + Profiler profiler = Profiler.createIfDebug(LoggerFactory.getLogger("foo")); assertThat(profiler).isInstanceOf(DefaultProfiler.class); tester.setLevel(LoggerLevel.INFO); - profiler = Profiler.createIfDebug(Loggers.get("foo")); + profiler = Profiler.createIfDebug(LoggerFactory.getLogger("foo")); assertThat(profiler).isInstanceOf(NullProfiler.class); } } diff --git a/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/fs/internal/AbstractProjectOrModule.java b/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/fs/internal/AbstractProjectOrModule.java index f173db4baf2..722b9e7c7cb 100644 --- a/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/fs/internal/AbstractProjectOrModule.java +++ b/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/fs/internal/AbstractProjectOrModule.java @@ -34,12 +34,12 @@ import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.SystemUtils; import org.sonar.api.CoreProperties; import org.sonar.api.batch.bootstrap.ProjectDefinition; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; @Immutable public abstract class AbstractProjectOrModule extends DefaultInputComponent { - private static final Logger LOGGER = Loggers.get(AbstractProjectOrModule.class); + private static final Logger LOGGER = LoggerFactory.getLogger(AbstractProjectOrModule.class); private final Path baseDir; private final Path workDir; private final String name; diff --git a/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/fs/internal/PathPattern.java b/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/fs/internal/PathPattern.java index 4a7016691e5..5036f3a4fcd 100644 --- a/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/fs/internal/PathPattern.java +++ b/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/fs/internal/PathPattern.java @@ -26,13 +26,13 @@ import org.apache.commons.io.FilenameUtils; import org.apache.commons.lang.StringUtils; import org.sonar.api.utils.PathUtils; import org.sonar.api.utils.WildcardPattern; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; @ThreadSafe public abstract class PathPattern { - private static final Logger LOG = Loggers.get(PathPattern.class); + private static final Logger LOG = LoggerFactory.getLogger(PathPattern.class); /** * @deprecated since 6.6 diff --git a/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/fs/internal/charhandler/LineCounter.java b/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/fs/internal/charhandler/LineCounter.java index c9cb288ccce..2cf8d83ec92 100644 --- a/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/fs/internal/charhandler/LineCounter.java +++ b/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/fs/internal/charhandler/LineCounter.java @@ -22,11 +22,11 @@ package org.sonar.api.batch.fs.internal.charhandler; import java.nio.charset.Charset; import org.sonar.api.CoreProperties; import org.sonar.api.notifications.AnalysisWarnings; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class LineCounter extends CharHandler { - private static final Logger LOG = Loggers.get(LineCounter.class); + private static final Logger LOG = LoggerFactory.getLogger(LineCounter.class); private final AnalysisWarnings analysisWarnings; private final String filePath; diff --git a/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/sensor/cpd/internal/DefaultCpdTokens.java b/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/sensor/cpd/internal/DefaultCpdTokens.java index b0498d44187..19ef905d971 100644 --- a/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/sensor/cpd/internal/DefaultCpdTokens.java +++ b/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/sensor/cpd/internal/DefaultCpdTokens.java @@ -27,15 +27,15 @@ import org.sonar.api.batch.fs.internal.DefaultInputFile; import org.sonar.api.batch.sensor.cpd.NewCpdTokens; import org.sonar.api.batch.sensor.internal.DefaultStorable; import org.sonar.api.batch.sensor.internal.SensorStorage; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; import static org.sonar.api.utils.Preconditions.checkState; public class DefaultCpdTokens extends DefaultStorable implements NewCpdTokens { - private static final Logger LOG = Loggers.get(DefaultCpdTokens.class); + private static final Logger LOG = LoggerFactory.getLogger(DefaultCpdTokens.class); private final List<TokensLine> result = new ArrayList<>(); private DefaultInputFile inputFile; private int startLine = Integer.MIN_VALUE; diff --git a/sonar-plugin-api-impl/src/main/java/org/sonar/api/impl/utils/DefaultTempFolder.java b/sonar-plugin-api-impl/src/main/java/org/sonar/api/impl/utils/DefaultTempFolder.java index b340985d157..d17843e347a 100644 --- a/sonar-plugin-api-impl/src/main/java/org/sonar/api/impl/utils/DefaultTempFolder.java +++ b/sonar-plugin-api-impl/src/main/java/org/sonar/api/impl/utils/DefaultTempFolder.java @@ -32,11 +32,11 @@ import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class DefaultTempFolder implements TempFolder, Startable { - private static final Logger LOG = Loggers.get(DefaultTempFolder.class); + private static final Logger LOG = LoggerFactory.getLogger(DefaultTempFolder.class); private final File tempDir; private final boolean deleteOnExit; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/GlobalServerSettingsProvider.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/GlobalServerSettingsProvider.java index b877a9f1815..ebe96be7911 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/GlobalServerSettingsProvider.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/GlobalServerSettingsProvider.java @@ -22,13 +22,13 @@ package org.sonar.scanner.bootstrap; import java.util.Map; import java.util.Optional; import org.sonar.api.CoreProperties; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.scanner.repository.settings.GlobalSettingsLoader; import org.springframework.context.annotation.Bean; public class GlobalServerSettingsProvider { - private static final Logger LOG = Loggers.get(GlobalServerSettingsProvider.class); + private static final Logger LOG = LoggerFactory.getLogger(GlobalServerSettingsProvider.class); @Bean("GlobalServerSettings") public GlobalServerSettings provide(GlobalSettingsLoader loader) { diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/GlobalTempFolderProvider.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/GlobalTempFolderProvider.java index e2125d8af69..8caa029f93b 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/GlobalTempFolderProvider.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/GlobalTempFolderProvider.java @@ -24,8 +24,8 @@ import org.sonar.api.CoreProperties; import org.sonar.api.impl.utils.DefaultTempFolder; import org.sonar.api.utils.System2; import org.sonar.api.utils.TempFolder; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import static org.sonar.core.util.FileUtils.deleteQuietly; import org.springframework.context.annotation.Bean; @@ -38,7 +38,7 @@ import java.nio.file.attribute.BasicFileAttributes; import java.util.concurrent.TimeUnit; public class GlobalTempFolderProvider { - private static final Logger LOG = Loggers.get(GlobalTempFolderProvider.class); + private static final Logger LOG = LoggerFactory.getLogger(GlobalTempFolderProvider.class); private static final long CLEAN_MAX_AGE = TimeUnit.DAYS.toMillis(21); static final String TMP_NAME_PREFIX = ".sonartmp_"; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/PluginFiles.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/PluginFiles.java index 17d6a622193..adc0c01247f 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/PluginFiles.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/PluginFiles.java @@ -31,8 +31,8 @@ import java.util.stream.Stream; import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.io.FileUtils; import org.sonar.api.config.Configuration; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.scanner.bootstrap.ScannerPluginInstaller.InstalledPlugin; import org.sonarqube.ws.client.GetRequest; import org.sonarqube.ws.client.HttpException; @@ -42,7 +42,7 @@ import static java.lang.String.format; public class PluginFiles { - private static final Logger LOGGER = Loggers.get(PluginFiles.class); + private static final Logger LOGGER = LoggerFactory.getLogger(PluginFiles.class); private static final String MD5_HEADER = "Sonar-MD5"; private final DefaultScannerWsClient wsClient; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerPluginRepository.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerPluginRepository.java index b46c2d2acd9..e96eb0889f4 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerPluginRepository.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerPluginRepository.java @@ -26,8 +26,8 @@ import java.util.stream.Collectors; import javax.annotation.CheckForNull; import org.sonar.api.Plugin; import org.sonar.api.Startable; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.core.platform.ExplodedPlugin; import org.sonar.core.platform.PluginClassLoader; import org.sonar.core.platform.PluginInfo; @@ -42,7 +42,7 @@ import static org.sonar.api.utils.Preconditions.checkState; * Orchestrates the installation and loading of plugins */ public class ScannerPluginRepository implements PluginRepository, Startable { - private static final Logger LOG = Loggers.get(ScannerPluginRepository.class); + private static final Logger LOG = LoggerFactory.getLogger(ScannerPluginRepository.class); private final PluginInstaller installer; private final PluginJarExploder pluginJarExploder; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/SpringGlobalContainer.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/SpringGlobalContainer.java index 8269ac8b113..b26017a0ff6 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/SpringGlobalContainer.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/SpringGlobalContainer.java @@ -34,8 +34,8 @@ import org.sonar.api.utils.MessageException; import org.sonar.api.utils.System2; import org.sonar.api.utils.UriReader; import org.sonar.api.utils.Version; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.core.documentation.DefaultDocumentationLinkGenerator; import org.sonar.core.extension.CoreExtensionRepositoryImpl; import org.sonar.core.extension.CoreExtensionsLoader; @@ -58,7 +58,7 @@ import org.sonar.scanner.scan.SpringProjectScanContainer; @Priority(3) public class SpringGlobalContainer extends SpringComponentContainer { - private static final Logger LOG = Loggers.get(SpringGlobalContainer.class); + private static final Logger LOG = LoggerFactory.getLogger(SpringGlobalContainer.class); private final Map<String, String> scannerProperties; private SpringGlobalContainer(Map<String, String> scannerProperties, List<?> addedExternally) { diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/ci/CiConfigurationProvider.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/ci/CiConfigurationProvider.java index 72af3137d7a..03a211e4f2a 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/ci/CiConfigurationProvider.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/ci/CiConfigurationProvider.java @@ -25,13 +25,13 @@ import java.util.Optional; import java.util.stream.Collectors; import org.sonar.api.config.Configuration; import org.sonar.api.utils.MessageException; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.context.annotation.Bean; public class CiConfigurationProvider { - private static final Logger LOG = Loggers.get(CiConfigurationProvider.class); + private static final Logger LOG = LoggerFactory.getLogger(CiConfigurationProvider.class); private static final String PROP_DISABLED = "sonar.ci.autoconfig.disabled"; @Bean("CiConfiguration") diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/ci/vendors/CirrusCi.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/ci/vendors/CirrusCi.java index 61083f9f394..5d8e2a1a302 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/ci/vendors/CirrusCi.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/ci/vendors/CirrusCi.java @@ -20,7 +20,7 @@ package org.sonar.scanner.ci.vendors; import org.sonar.api.utils.System2; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.LoggerFactory; import org.sonar.scanner.ci.CiConfiguration; import org.sonar.scanner.ci.CiConfigurationImpl; import org.sonar.scanner.ci.CiVendor; @@ -55,7 +55,7 @@ public class CirrusCi implements CiVendor { public CiConfiguration loadConfiguration() { String revision = system.envVariable(PROPERTY_COMMIT); if (isEmpty(revision)) { - Loggers.get(getClass()).warn("Missing environment variable " + PROPERTY_COMMIT); + LoggerFactory.getLogger(getClass()).warn("Missing environment variable " + PROPERTY_COMMIT); } return new CiConfigurationImpl(revision, getName()); } diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/ci/vendors/CodeMagic.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/ci/vendors/CodeMagic.java index 3a864fd9858..1ceb823a01b 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/ci/vendors/CodeMagic.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/ci/vendors/CodeMagic.java @@ -20,8 +20,8 @@ package org.sonar.scanner.ci.vendors; import org.sonar.api.utils.System2; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.scanner.ci.CiConfiguration; import org.sonar.scanner.ci.CiConfigurationImpl; import org.sonar.scanner.ci.CiVendor; @@ -30,7 +30,7 @@ import static org.apache.commons.lang.StringUtils.isEmpty; public class CodeMagic implements CiVendor { - private static final Logger LOG = Loggers.get(CodeMagic.class); + private static final Logger LOG = LoggerFactory.getLogger(CodeMagic.class); private final System2 system; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/ci/vendors/GithubActions.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/ci/vendors/GithubActions.java index ae2cb0825d0..d68cf713200 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/ci/vendors/GithubActions.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/ci/vendors/GithubActions.java @@ -21,7 +21,7 @@ package org.sonar.scanner.ci.vendors; import org.apache.commons.lang.StringUtils; import org.sonar.api.utils.System2; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.LoggerFactory; import org.sonar.scanner.ci.CiConfiguration; import org.sonar.scanner.ci.CiConfigurationImpl; import org.sonar.scanner.ci.CiVendor; @@ -57,7 +57,7 @@ public class GithubActions implements CiVendor { public CiConfiguration loadConfiguration() { String revision = system.envVariable(PROPERTY_COMMIT); if (isEmpty(revision)) { - Loggers.get(getClass()).warn("Missing environment variable " + PROPERTY_COMMIT); + LoggerFactory.getLogger(getClass()).warn("Missing environment variable " + PROPERTY_COMMIT); } return new CiConfigurationImpl(revision, getName()); } diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/ci/vendors/Jenkins.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/ci/vendors/Jenkins.java index 03aa798a6f1..0f53ae29d1d 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/ci/vendors/Jenkins.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/ci/vendors/Jenkins.java @@ -28,8 +28,8 @@ import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.lib.RepositoryBuilder; import org.sonar.api.batch.fs.internal.DefaultInputProject; import org.sonar.api.utils.System2; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.scanner.ci.CiConfiguration; import org.sonar.scanner.ci.CiConfigurationImpl; import org.sonar.scanner.ci.CiVendor; @@ -37,7 +37,7 @@ import org.sonar.scanner.ci.CiVendor; import static org.apache.commons.lang.StringUtils.isNotBlank; public class Jenkins implements CiVendor { - private static final Logger LOG = Loggers.get(Jenkins.class); + private static final Logger LOG = LoggerFactory.getLogger(Jenkins.class); private final System2 system; private final DefaultInputProject inputProject; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/config/DefaultConfiguration.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/config/DefaultConfiguration.java index 2855c44034b..a238807189e 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/config/DefaultConfiguration.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/config/DefaultConfiguration.java @@ -29,8 +29,8 @@ import org.sonar.api.config.Configuration; import org.sonar.api.config.internal.Encryption; import org.sonar.api.config.PropertyDefinition; import org.sonar.api.config.PropertyDefinitions; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import static java.util.Objects.requireNonNull; import static org.apache.commons.lang.StringUtils.trim; @@ -39,7 +39,7 @@ import static org.sonar.api.config.internal.MultivalueProperty.parseAsCsv; @Immutable public abstract class DefaultConfiguration implements Configuration { - private static final Logger LOG = Loggers.get(DefaultConfiguration.class); + private static final Logger LOG = LoggerFactory.getLogger(DefaultConfiguration.class); private final PropertyDefinitions definitions; private final Encryption encryption; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/cpd/CpdExecutor.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/cpd/CpdExecutor.java index e64b8a757e3..9e02a22be0a 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/cpd/CpdExecutor.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/cpd/CpdExecutor.java @@ -36,8 +36,8 @@ import javax.inject.Inject; import org.sonar.api.batch.fs.InputComponent; import org.sonar.api.batch.fs.internal.DefaultInputComponent; import org.sonar.api.batch.fs.internal.DefaultInputFile; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.duplications.block.Block; import org.sonar.duplications.detector.suffixtree.SuffixTreeCloneDetectionAlgorithm; import org.sonar.duplications.index.CloneGroup; @@ -57,7 +57,7 @@ import org.sonar.scanner.util.ProgressReport; * The sensors are responsible for handling exclusions and block sizes. */ public class CpdExecutor { - private static final Logger LOG = Loggers.get(CpdExecutor.class); + private static final Logger LOG = LoggerFactory.getLogger(CpdExecutor.class); // timeout for the computation of duplicates in a file (seconds) private static final int TIMEOUT = 5 * 60 * 1000; static final int MAX_CLONE_GROUP_PER_FILE = 100; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/cpd/index/SonarCpdBlockIndex.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/cpd/index/SonarCpdBlockIndex.java index f6df5a21208..46d56962acc 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/cpd/index/SonarCpdBlockIndex.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/cpd/index/SonarCpdBlockIndex.java @@ -25,8 +25,8 @@ import java.util.Iterator; import java.util.Set; import java.util.stream.Collectors; import org.sonar.api.batch.fs.InputFile; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.duplications.block.Block; import org.sonar.duplications.block.ByteArray; import org.sonar.duplications.index.AbstractCloneIndex; @@ -40,7 +40,7 @@ import org.sonar.scanner.protocol.output.ScannerReport; import org.sonar.scanner.report.ReportPublisher; public class SonarCpdBlockIndex extends AbstractCloneIndex { - private static final Logger LOG = Loggers.get(SonarCpdBlockIndex.class); + private static final Logger LOG = LoggerFactory.getLogger(SonarCpdBlockIndex.class); private final CloneIndex mem = new PackedMemoryCloneIndex(); private final ReportPublisher publisher; // Files already tokenized diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/externalissue/ExternalIssueImporter.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/externalissue/ExternalIssueImporter.java index 468c2fdec1a..00eeb9a3a8a 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/externalissue/ExternalIssueImporter.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/externalissue/ExternalIssueImporter.java @@ -30,14 +30,14 @@ import org.sonar.api.batch.sensor.SensorContext; import org.sonar.api.batch.sensor.issue.NewExternalIssue; import org.sonar.api.batch.sensor.issue.NewIssueLocation; import org.sonar.api.rules.RuleType; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.scanner.externalissue.ReportParser.Issue; import org.sonar.scanner.externalissue.ReportParser.Location; import org.sonar.scanner.externalissue.ReportParser.Report; public class ExternalIssueImporter { - private static final Logger LOG = Loggers.get(ExternalIssueImporter.class); + private static final Logger LOG = LoggerFactory.getLogger(ExternalIssueImporter.class); private static final int MAX_UNKNOWN_FILE_PATHS_TO_PRINT = 5; private final SensorContext context; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/externalissue/ExternalIssuesImportSensor.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/externalissue/ExternalIssuesImportSensor.java index 6d698e98605..508523a4527 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/externalissue/ExternalIssuesImportSensor.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/externalissue/ExternalIssuesImportSensor.java @@ -32,12 +32,12 @@ import org.sonar.api.batch.sensor.SensorDescriptor; import org.sonar.api.config.Configuration; import org.sonar.api.config.PropertyDefinition; import org.sonar.api.resources.Qualifiers; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.scanner.externalissue.ReportParser.Report; public class ExternalIssuesImportSensor implements Sensor { - private static final Logger LOG = Loggers.get(ExternalIssuesImportSensor.class); + private static final Logger LOG = LoggerFactory.getLogger(ExternalIssuesImportSensor.class); static final String REPORT_PATHS_PROPERTY_KEY = "sonar.externalIssuesReportPaths"; private final Configuration config; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/externalissue/sarif/DefaultSarif210Importer.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/externalissue/sarif/DefaultSarif210Importer.java index 09888ee5199..57fcfee61a9 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/externalissue/sarif/DefaultSarif210Importer.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/externalissue/sarif/DefaultSarif210Importer.java @@ -24,8 +24,8 @@ import java.util.Set; import javax.annotation.CheckForNull; import org.sonar.api.batch.sensor.issue.NewExternalIssue; import org.sonar.api.scanner.ScannerSide; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.core.sarif.Run; import org.sonar.core.sarif.Sarif210; @@ -33,7 +33,7 @@ import static java.util.Objects.requireNonNull; @ScannerSide public class DefaultSarif210Importer implements Sarif210Importer { - private static final Logger LOG = Loggers.get(DefaultSarif210Importer.class); + private static final Logger LOG = LoggerFactory.getLogger(DefaultSarif210Importer.class); private final RunMapper runMapper; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/externalissue/sarif/RulesSeverityDetector.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/externalissue/sarif/RulesSeverityDetector.java index d02744371b7..10141fd8215 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/externalissue/sarif/RulesSeverityDetector.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/externalissue/sarif/RulesSeverityDetector.java @@ -27,8 +27,8 @@ import java.util.Set; import java.util.function.Predicate; import javax.annotation.Nullable; import org.sonar.api.batch.rule.Severity; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.core.sarif.DefaultConfiguration; import org.sonar.core.sarif.Extension; import org.sonar.core.sarif.Result; @@ -43,7 +43,7 @@ import static java.util.stream.Collectors.toMap; import static org.sonar.scanner.externalissue.sarif.ResultMapper.DEFAULT_SEVERITY; public class RulesSeverityDetector { - private static final Logger LOG = Loggers.get(RulesSeverityDetector.class); + private static final Logger LOG = LoggerFactory.getLogger(RulesSeverityDetector.class); public static final String UNSUPPORTED_RULE_SEVERITIES_WARNING = "Unable to detect rules severity for issue detected by tool %s, falling back to default rule severity: %s"; private RulesSeverityDetector() {} diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/externalissue/sarif/RunMapper.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/externalissue/sarif/RunMapper.java index ded11070476..6131daa1763 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/externalissue/sarif/RunMapper.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/externalissue/sarif/RunMapper.java @@ -25,8 +25,8 @@ import java.util.Optional; import javax.annotation.Nullable; import org.sonar.api.batch.sensor.issue.NewExternalIssue; import org.sonar.api.scanner.ScannerSide; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.core.sarif.Driver; import org.sonar.core.sarif.Result; import org.sonar.core.sarif.Run; @@ -38,7 +38,7 @@ import static org.sonar.api.utils.Preconditions.checkArgument; @ScannerSide public class RunMapper { - private static final Logger LOG = Loggers.get(RunMapper.class); + private static final Logger LOG = LoggerFactory.getLogger(RunMapper.class); private final ResultMapper resultMapper; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/genericcoverage/GenericCoverageReportParser.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/genericcoverage/GenericCoverageReportParser.java index df8865a1b37..73f0593f508 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/genericcoverage/GenericCoverageReportParser.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/genericcoverage/GenericCoverageReportParser.java @@ -33,11 +33,11 @@ import org.sonar.api.batch.fs.InputFile; import org.sonar.api.batch.sensor.SensorContext; import org.sonar.api.batch.sensor.coverage.NewCoverage; import org.sonar.api.utils.MessageException; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class GenericCoverageReportParser { - private static final Logger LOG = Loggers.get(GenericCoverageReportParser.class); + private static final Logger LOG = LoggerFactory.getLogger(GenericCoverageReportParser.class); private static final String LINE_NUMBER_ATTR = "lineNumber"; private static final String COVERED_ATTR = "covered"; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/genericcoverage/GenericCoverageSensor.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/genericcoverage/GenericCoverageSensor.java index be570858d15..64aa830b0e1 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/genericcoverage/GenericCoverageSensor.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/genericcoverage/GenericCoverageSensor.java @@ -31,15 +31,15 @@ import org.sonar.api.batch.sensor.SensorDescriptor; import org.sonar.api.config.PropertyDefinition; import org.sonar.api.resources.Qualifiers; import org.sonar.api.scanner.sensor.ProjectSensor; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.scanner.config.DefaultConfiguration; import static org.sonar.api.CoreProperties.CATEGORY_CODE_COVERAGE; public class GenericCoverageSensor implements ProjectSensor { - private static final Logger LOG = Loggers.get(GenericCoverageSensor.class); + private static final Logger LOG = LoggerFactory.getLogger(GenericCoverageSensor.class); static final String REPORT_PATHS_PROPERTY_KEY = "sonar.coverageReportPaths"; private final DefaultConfiguration config; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/genericcoverage/GenericTestExecutionReportParser.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/genericcoverage/GenericTestExecutionReportParser.java index e60e3a015da..49bcd2da928 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/genericcoverage/GenericTestExecutionReportParser.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/genericcoverage/GenericTestExecutionReportParser.java @@ -32,8 +32,8 @@ import org.codehaus.staxmate.in.SMInputCursor; import org.sonar.api.batch.fs.InputFile; import org.sonar.api.batch.sensor.SensorContext; import org.sonar.api.utils.MessageException; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.scanner.deprecated.test.DefaultTestCase; import org.sonar.scanner.deprecated.test.DefaultTestCase.Status; import org.sonar.scanner.deprecated.test.DefaultTestPlan; @@ -50,7 +50,7 @@ public class GenericTestExecutionReportParser { private static final String OLD_ROOT_ELEMENT = "unitTest"; - private static final Logger LOG = Loggers.get(GenericTestExecutionReportParser.class); + private static final Logger LOG = LoggerFactory.getLogger(GenericTestExecutionReportParser.class); private static final String NAME_ATTR = "name"; private static final String DURATION_ATTR = "duration"; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/genericcoverage/GenericTestExecutionSensor.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/genericcoverage/GenericTestExecutionSensor.java index 4d19f0f6411..dfd90fdf66a 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/genericcoverage/GenericTestExecutionSensor.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/genericcoverage/GenericTestExecutionSensor.java @@ -28,8 +28,8 @@ import org.sonar.api.batch.sensor.SensorContext; import org.sonar.api.batch.sensor.SensorDescriptor; import org.sonar.api.config.PropertyDefinition; import org.sonar.api.resources.Qualifiers; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.scanner.config.DefaultConfiguration; import org.sonar.scanner.deprecated.test.TestPlanBuilder; @@ -37,7 +37,7 @@ import static org.sonar.api.CoreProperties.CATEGORY_CODE_COVERAGE; public class GenericTestExecutionSensor implements Sensor { - private static final Logger LOG = Loggers.get(GenericTestExecutionSensor.class); + private static final Logger LOG = LoggerFactory.getLogger(GenericTestExecutionSensor.class); static final String REPORT_PATHS_PROPERTY_KEY = "sonar.testExecutionReportPaths"; /** diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/ignore/EnforceIssuesFilter.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/ignore/EnforceIssuesFilter.java index afce2b62936..82a29265899 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/ignore/EnforceIssuesFilter.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/ignore/EnforceIssuesFilter.java @@ -31,15 +31,15 @@ import org.sonar.api.rule.RuleKey; import org.sonar.api.scan.issue.filter.FilterableIssue; import org.sonar.api.scan.issue.filter.IssueFilter; import org.sonar.api.scan.issue.filter.IssueFilterChain; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.scanner.issue.DefaultFilterableIssue; import org.sonar.scanner.issue.ignore.pattern.IssueInclusionPatternInitializer; import org.sonar.scanner.issue.ignore.pattern.IssuePattern; @ThreadSafe public class EnforceIssuesFilter implements IssueFilter { - private static final Logger LOG = Loggers.get(EnforceIssuesFilter.class); + private static final Logger LOG = LoggerFactory.getLogger(EnforceIssuesFilter.class); private final List<IssuePattern> multicriteriaPatterns; private final AnalysisWarnings analysisWarnings; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/ignore/IgnoreIssuesFilter.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/ignore/IgnoreIssuesFilter.java index 663fe727197..37e00d1db68 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/ignore/IgnoreIssuesFilter.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/ignore/IgnoreIssuesFilter.java @@ -35,17 +35,17 @@ import org.sonar.api.scan.issue.filter.FilterableIssue; import org.sonar.api.scan.issue.filter.IssueFilter; import org.sonar.api.scan.issue.filter.IssueFilterChain; import org.sonar.api.utils.WildcardPattern; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.scanner.issue.DefaultFilterableIssue; public class IgnoreIssuesFilter implements IssueFilter { + private static final Logger LOG = LoggerFactory.getLogger(IgnoreIssuesFilter.class); private final DefaultActiveRules activeRules; private final AnalysisWarnings analysisWarnings; private final Map<InputComponent, List<WildcardPattern>> rulePatternByComponent = new HashMap<>(); private final Set<RuleKey> warnedDeprecatedRuleKeys = new LinkedHashSet<>(); - private static final Logger LOG = Loggers.get(IgnoreIssuesFilter.class); public IgnoreIssuesFilter(DefaultActiveRules activeRules, AnalysisWarnings analysisWarnings) { this.activeRules = activeRules; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/ignore/scanner/IssueExclusionsLoader.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/ignore/scanner/IssueExclusionsLoader.java index a770753fe03..0c87eb58066 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/ignore/scanner/IssueExclusionsLoader.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/ignore/scanner/IssueExclusionsLoader.java @@ -24,8 +24,8 @@ import java.util.List; import javax.annotation.CheckForNull; import org.apache.commons.lang.StringUtils; import org.sonar.api.notifications.AnalysisWarnings; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.api.batch.fs.internal.DefaultInputFile; import org.sonar.api.batch.fs.internal.charhandler.CharHandler; import org.sonar.scanner.issue.ignore.IgnoreIssuesFilter; @@ -34,7 +34,7 @@ import org.sonar.scanner.issue.ignore.pattern.IssueExclusionPatternInitializer; import org.sonar.scanner.issue.ignore.pattern.IssuePattern; public final class IssueExclusionsLoader { - private static final Logger LOG = Loggers.get(IssueExclusionsLoader.class); + private static final Logger LOG = LoggerFactory.getLogger(IssueExclusionsLoader.class); private final List<java.util.regex.Pattern> allFilePatterns; private final List<DoubleRegexpMatcher> blockMatchers; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/ignore/scanner/IssueExclusionsRegexpScanner.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/ignore/scanner/IssueExclusionsRegexpScanner.java index 0ae7733c307..5f2b993cf89 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/ignore/scanner/IssueExclusionsRegexpScanner.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/ignore/scanner/IssueExclusionsRegexpScanner.java @@ -25,15 +25,15 @@ import java.util.List; import java.util.Set; import java.util.regex.Pattern; import java.util.stream.Collectors; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.api.batch.fs.internal.DefaultInputFile; import org.sonar.api.batch.fs.internal.charhandler.CharHandler; import org.sonar.scanner.issue.ignore.pattern.LineRange; import org.sonar.scanner.issue.ignore.scanner.IssueExclusionsLoader.DoubleRegexpMatcher; public class IssueExclusionsRegexpScanner extends CharHandler { - private static final Logger LOG = Loggers.get(IssueExclusionsLoader.class); + private static final Logger LOG = LoggerFactory.getLogger(IssueExclusionsRegexpScanner.class); private final StringBuilder sb = new StringBuilder(); private final List<Pattern> allFilePatterns; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/qualitygate/QualityGateCheck.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/qualitygate/QualityGateCheck.java index 94a07481852..2f9fdd3267c 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/qualitygate/QualityGateCheck.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/qualitygate/QualityGateCheck.java @@ -25,8 +25,8 @@ import java.time.temporal.ChronoUnit; import java.util.EnumSet; import org.sonar.api.Startable; import org.sonar.api.utils.MessageException; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.scanner.bootstrap.DefaultScannerWsClient; import org.sonar.scanner.bootstrap.GlobalAnalysisMode; import org.sonar.scanner.report.CeTaskReportDataHolder; @@ -42,7 +42,7 @@ import org.sonarqube.ws.client.WsResponse; public class QualityGateCheck implements Startable { - private static final Logger LOG = Loggers.get(QualityGateCheck.class); + private static final Logger LOG = LoggerFactory.getLogger(QualityGateCheck.class); private static final EnumSet<TaskStatus> TASK_TERMINAL_STATUSES = EnumSet.of(TaskStatus.SUCCESS, TaskStatus.FAILED, TaskStatus.CANCELED); private static final int POLLING_INTERVAL_IN_MS = 5000; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/MetadataPublisher.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/MetadataPublisher.java index 6ee1fb5b289..88932df8f99 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/MetadataPublisher.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/MetadataPublisher.java @@ -25,8 +25,8 @@ import java.util.Map.Entry; import java.util.regex.Pattern; import org.sonar.api.batch.fs.internal.AbstractProjectOrModule; import org.sonar.api.batch.scm.ScmProvider; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.scanner.ProjectInfo; import org.sonar.scanner.bootstrap.ScannerPlugin; import org.sonar.scanner.bootstrap.ScannerPluginRepository; @@ -45,7 +45,7 @@ import org.sonar.scanner.scm.ScmRevision; public class MetadataPublisher implements ReportPublisherStep { - private static final Logger LOG = Loggers.get(MetadataPublisher.class); + private static final Logger LOG = LoggerFactory.getLogger(MetadataPublisher.class); private final QualityProfiles qProfiles; private final ProjectInfo projectInfo; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/ReportPublisher.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/ReportPublisher.java index 8d9d88d29c3..de28e7957a5 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/ReportPublisher.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/ReportPublisher.java @@ -40,8 +40,8 @@ import org.sonar.api.platform.Server; import org.sonar.api.utils.MessageException; import org.sonar.api.utils.TempFolder; import org.sonar.api.utils.ZipUtils; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.scanner.bootstrap.DefaultScannerWsClient; import org.sonar.scanner.bootstrap.GlobalAnalysisMode; import org.sonar.scanner.fs.InputModuleHierarchy; @@ -66,7 +66,7 @@ import static org.sonar.core.util.FileUtils.humanReadableByteCountSI; import static org.sonar.scanner.scan.branch.BranchType.PULL_REQUEST; public class ReportPublisher implements Startable { - private static final Logger LOG = Loggers.get(ReportPublisher.class); + private static final Logger LOG = LoggerFactory.getLogger(ReportPublisher.class); private static final String CHARACTERISTIC = "characteristic"; private static final String DASHBOARD = "dashboard"; private static final String BRANCH = "branch"; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/DeprecatedPropertiesWarningGenerator.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/DeprecatedPropertiesWarningGenerator.java index 0a2b46d7a57..248bdf716bd 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/DeprecatedPropertiesWarningGenerator.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/DeprecatedPropertiesWarningGenerator.java @@ -25,13 +25,13 @@ import org.apache.commons.lang.StringUtils; import org.sonar.api.CoreProperties; import org.sonar.api.config.Configuration; import org.sonar.api.notifications.AnalysisWarnings; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.batch.bootstrapper.EnvironmentInformation; import org.sonar.scanner.bootstrap.ScannerWsClientProvider; public class DeprecatedPropertiesWarningGenerator { - private static final Logger LOG = Loggers.get(DeprecatedPropertiesWarningGenerator.class); + private static final Logger LOG = LoggerFactory.getLogger(DeprecatedPropertiesWarningGenerator.class); @VisibleForTesting static final String PASSWORD_WARN_MESSAGE = String.format("The properties '%s' and '%s' are deprecated and will be removed in the " + diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/InputModuleHierarchyProvider.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/InputModuleHierarchyProvider.java index 347f7faab30..e634dac4cf3 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/InputModuleHierarchyProvider.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/InputModuleHierarchyProvider.java @@ -25,14 +25,14 @@ import java.util.Map; import org.sonar.api.batch.bootstrap.ProjectDefinition; import org.sonar.api.batch.fs.internal.DefaultInputModule; import org.sonar.api.batch.fs.internal.DefaultInputProject; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.scanner.scan.filesystem.ScannerComponentIdGenerator; import org.springframework.context.annotation.Bean; public class InputModuleHierarchyProvider { - private static final Logger LOG = Loggers.get(InputModuleHierarchyProvider.class); + private static final Logger LOG = LoggerFactory.getLogger(InputModuleHierarchyProvider.class); @Bean("DefaultInputModuleHierarchy") public DefaultInputModuleHierarchy provide(ScannerComponentIdGenerator scannerComponentIdGenerator, WorkDirectoriesInitializer workDirectoriesInit, DefaultInputProject project) { diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/InputProjectProvider.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/InputProjectProvider.java index 2df97afdb17..50e89502d91 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/InputProjectProvider.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/InputProjectProvider.java @@ -22,13 +22,13 @@ package org.sonar.scanner.scan; import java.util.Locale; import org.sonar.api.batch.bootstrap.ProjectReactor; import org.sonar.api.batch.fs.internal.DefaultInputProject; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.scanner.scan.filesystem.ScannerComponentIdGenerator; import org.springframework.context.annotation.Bean; public class InputProjectProvider { - private static final Logger LOG = Loggers.get(InputProjectProvider.class); + private static final Logger LOG = LoggerFactory.getLogger(InputProjectProvider.class); @Bean("DefaultInputProject") public DefaultInputProject provide(ProjectBuildersExecutor projectBuildersExecutor, ProjectReactorValidator validator, diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectServerSettingsProvider.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectServerSettingsProvider.java index c807b7781f3..3a5d05f6f3a 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectServerSettingsProvider.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectServerSettingsProvider.java @@ -23,14 +23,14 @@ import java.util.Map; import org.apache.commons.lang.StringUtils; import org.sonar.api.CoreProperties; import org.sonar.api.notifications.AnalysisWarnings; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.scanner.repository.settings.ProjectSettingsLoader; import org.springframework.context.annotation.Bean; public class ProjectServerSettingsProvider { - private static final Logger LOG = Loggers.get(ProjectServerSettingsProvider.class); + private static final Logger LOG = LoggerFactory.getLogger(ProjectServerSettingsProvider.class); private static final String MODULE_LEVEL_ARCHIVED_SETTINGS_WARNING = "Settings that were previously configured at " + "sub-project level are not used anymore. Transition the settings listed in ‘General Settings -> General -> " + diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/SpringProjectScanContainer.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/SpringProjectScanContainer.java index 0dc9d6adce5..9cb9d8b509d 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/SpringProjectScanContainer.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/SpringProjectScanContainer.java @@ -29,8 +29,8 @@ import org.sonar.api.batch.sensor.issue.internal.DefaultNoSonarFilter; import org.sonar.api.resources.ResourceTypes; import org.sonar.api.scan.filesystem.PathResolver; import org.sonar.api.utils.MessageException; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.core.config.ScannerProperties; import org.sonar.core.extension.CoreExtensionsInstaller; import org.sonar.core.language.LanguagesProvider; @@ -145,7 +145,7 @@ import static org.sonar.scanner.bootstrap.ExtensionUtils.isScannerSide; @Priority(2) public class SpringProjectScanContainer extends SpringComponentContainer { - private static final Logger LOG = Loggers.get(SpringProjectScanContainer.class); + private static final Logger LOG = LoggerFactory.getLogger(SpringProjectScanContainer.class); public SpringProjectScanContainer(SpringComponentContainer globalContainer) { super(globalContainer); diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/AbstractCoverageAndDuplicationExclusions.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/AbstractCoverageAndDuplicationExclusions.java index 879dc99942d..0f059dbc2cf 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/AbstractCoverageAndDuplicationExclusions.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/AbstractCoverageAndDuplicationExclusions.java @@ -26,15 +26,15 @@ import java.util.stream.Stream; import javax.annotation.concurrent.Immutable; import org.sonar.api.CoreProperties; import org.sonar.api.utils.WildcardPattern; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.api.batch.fs.internal.DefaultInputFile; import static java.util.stream.Collectors.toList; @Immutable public abstract class AbstractCoverageAndDuplicationExclusions { - private static final Logger LOG = Loggers.get(AbstractCoverageAndDuplicationExclusions.class); + private static final Logger LOG = LoggerFactory.getLogger(AbstractCoverageAndDuplicationExclusions.class); private final Function<DefaultInputFile, String> pathExtractor; private final String[] coverageExclusionConfig; private final String[] duplicationExclusionConfig; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/AbstractExclusionFilters.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/AbstractExclusionFilters.java index b5ade4c59ed..febec2f183b 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/AbstractExclusionFilters.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/AbstractExclusionFilters.java @@ -30,8 +30,8 @@ import org.sonar.api.CoreProperties; import org.sonar.api.batch.fs.InputFile; import org.sonar.api.batch.fs.internal.PathPattern; import org.sonar.api.notifications.AnalysisWarnings; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import static java.lang.String.format; import static org.sonar.api.CoreProperties.PROJECT_TESTS_EXCLUSIONS_PROPERTY; @@ -41,7 +41,7 @@ import static org.sonar.api.CoreProperties.PROJECT_TEST_INCLUSIONS_PROPERTY; public abstract class AbstractExclusionFilters { - private static final Logger LOG = Loggers.get(AbstractExclusionFilters.class); + private static final Logger LOG = LoggerFactory.getLogger(AbstractExclusionFilters.class); private static final String WARNING_ALIAS_PROPERTY_USAGE = "Use of %s detected. While being taken into account, the only supported property is %s." + " Consider updating your configuration."; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/FileIndexer.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/FileIndexer.java index 2d177d4edee..4d9b8c2a377 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/FileIndexer.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/FileIndexer.java @@ -39,8 +39,8 @@ import org.sonar.api.batch.fs.internal.SensorStrategy; import org.sonar.api.batch.scm.IgnoreCommand; import org.sonar.api.notifications.AnalysisWarnings; import org.sonar.api.utils.MessageException; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.scanner.issue.ignore.scanner.IssueExclusionsLoader; import org.sonar.scanner.repository.language.Language; import org.sonar.scanner.scan.ScanProperties; @@ -54,7 +54,7 @@ import static java.lang.String.format; */ public class FileIndexer { - private static final Logger LOG = Loggers.get(FileIndexer.class); + private static final Logger LOG = LoggerFactory.getLogger(FileIndexer.class); private final AnalysisWarnings analysisWarnings; private final ScanProperties properties; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/MetadataGenerator.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/MetadataGenerator.java index 562fcbe338a..3581d24d0b2 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/MetadataGenerator.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/MetadataGenerator.java @@ -25,12 +25,12 @@ import org.sonar.api.batch.fs.InputFile.Type; import org.sonar.api.batch.fs.internal.DefaultInputFile; import org.sonar.api.batch.fs.internal.FileMetadata; import org.sonar.api.batch.fs.internal.Metadata; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.scanner.issue.ignore.scanner.IssueExclusionsLoader; public class MetadataGenerator { - private static final Logger LOG = Loggers.get(MetadataGenerator.class); + private static final Logger LOG = LoggerFactory.getLogger(MetadataGenerator.class); static final Charset UTF_32BE = Charset.forName("UTF-32BE"); static final Charset UTF_32LE = Charset.forName("UTF-32LE"); diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/ProjectFileIndexer.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/ProjectFileIndexer.java index 46336597f6d..35d5bf3fdb4 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/ProjectFileIndexer.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/ProjectFileIndexer.java @@ -45,8 +45,8 @@ import org.sonar.api.batch.fs.internal.DefaultInputModule; import org.sonar.api.batch.scm.IgnoreCommand; import org.sonar.api.notifications.AnalysisWarnings; import org.sonar.api.scan.filesystem.PathResolver; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.scanner.bootstrap.GlobalConfiguration; import org.sonar.scanner.bootstrap.GlobalServerSettings; import org.sonar.scanner.fs.InputModuleHierarchy; @@ -65,7 +65,7 @@ import static java.util.Collections.singletonList; */ public class ProjectFileIndexer { - private static final Logger LOG = Loggers.get(ProjectFileIndexer.class); + private static final Logger LOG = LoggerFactory.getLogger(ProjectFileIndexer.class); private final ProjectExclusionFilters projectExclusionFilters; private final SonarGlobalPropertiesFilter sonarGlobalPropertiesFilter; private final ProjectCoverageAndDuplicationExclusions projectCoverageAndDuplicationExclusions; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scm/DefaultBlameOutput.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scm/DefaultBlameOutput.java index 11ec6835ec4..b8ec3fb8274 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scm/DefaultBlameOutput.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scm/DefaultBlameOutput.java @@ -34,8 +34,8 @@ import org.sonar.api.batch.fs.internal.DefaultInputFile; import org.sonar.api.batch.scm.BlameCommand.BlameOutput; import org.sonar.api.batch.scm.BlameLine; import org.sonar.api.notifications.AnalysisWarnings; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.core.documentation.DocumentationLinkGenerator; import org.sonar.scanner.protocol.output.ScannerReport; import org.sonar.scanner.protocol.output.ScannerReport.Changesets.Builder; @@ -47,7 +47,7 @@ import static org.sonar.api.utils.Preconditions.checkArgument; class DefaultBlameOutput implements BlameOutput { - private static final Logger LOG = Loggers.get(DefaultBlameOutput.class); + private static final Logger LOG = LoggerFactory.getLogger(DefaultBlameOutput.class); @VisibleForTesting static final String SCM_INTEGRATION_DOCUMENTATION_SUFFIX = "/analyzing-source-code/scm-integration/"; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scm/ScmConfiguration.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scm/ScmConfiguration.java index 098b773fa16..a94e2dbb6d3 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scm/ScmConfiguration.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scm/ScmConfiguration.java @@ -33,8 +33,8 @@ import org.sonar.api.batch.scm.ScmProvider; import org.sonar.api.config.Configuration; import org.sonar.api.notifications.AnalysisWarnings; import org.sonar.api.utils.MessageException; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.core.config.ScannerProperties; import org.sonar.scanner.fs.InputModuleHierarchy; @@ -53,7 +53,7 @@ import static org.sonar.api.CoreProperties.SCM_PROVIDER_KEY; type = PropertyType.BOOLEAN) }) public class ScmConfiguration implements Startable { - private static final Logger LOG = Loggers.get(ScmConfiguration.class); + private static final Logger LOG = LoggerFactory.getLogger(ScmConfiguration.class); public static final String FORCE_RELOAD_KEY = "sonar.scm.forceReloadAll"; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scm/ScmPublisher.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scm/ScmPublisher.java index cabf45a65cf..ecd331a7569 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scm/ScmPublisher.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scm/ScmPublisher.java @@ -29,8 +29,8 @@ import org.sonar.api.batch.fs.InputFile.Status; import org.sonar.api.batch.fs.internal.DefaultInputFile; import org.sonar.api.batch.scm.ScmProvider; import org.sonar.api.notifications.AnalysisWarnings; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.core.documentation.DocumentationLinkGenerator; import org.sonar.scanner.protocol.output.ScannerReport; import org.sonar.scanner.protocol.output.ScannerReport.Changesets.Builder; @@ -43,7 +43,7 @@ import org.sonar.scanner.scan.filesystem.InputComponentStore; public final class ScmPublisher { - private static final Logger LOG = Loggers.get(ScmPublisher.class); + private static final Logger LOG = LoggerFactory.getLogger(ScmPublisher.class); private final ScmConfiguration configuration; private final ProjectRepositories projectRepositories; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scm/ScmRevisionImpl.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scm/ScmRevisionImpl.java index a27af6beb3f..aede322d948 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scm/ScmRevisionImpl.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scm/ScmRevisionImpl.java @@ -21,8 +21,8 @@ package org.sonar.scanner.scm; import java.util.Optional; import org.sonar.api.batch.scm.ScmProvider; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.scanner.bootstrap.ScannerProperties; import org.sonar.scanner.ci.CiConfiguration; import org.sonar.scanner.fs.InputModuleHierarchy; @@ -32,7 +32,7 @@ import static org.sonar.scanner.scan.ScanProperties.SCM_REVISION; public class ScmRevisionImpl implements ScmRevision { - private static final Logger LOG = Loggers.get(ScmRevisionImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(ScmRevisionImpl.class); private final CiConfiguration ciConfiguration; private final ScannerProperties scannerConfiguration; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/AbstractSensorWrapper.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/AbstractSensorWrapper.java index 8dd91949af1..8f51fa78062 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/AbstractSensorWrapper.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/AbstractSensorWrapper.java @@ -22,14 +22,14 @@ package org.sonar.scanner.sensor; import org.sonar.api.batch.sensor.SensorContext; import org.sonar.api.batch.sensor.internal.DefaultSensorDescriptor; import org.sonar.api.scanner.sensor.ProjectSensor; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.scanner.scan.branch.BranchConfiguration; import org.sonar.scanner.scan.branch.BranchType; import org.sonar.scanner.scan.filesystem.MutableFileSystem; public abstract class AbstractSensorWrapper<G extends ProjectSensor> { - private static final Logger LOGGER = Loggers.get(AbstractSensorWrapper.class); + private static final Logger LOGGER = LoggerFactory.getLogger(AbstractSensorWrapper.class); private final G wrappedSensor; private final SensorContext context; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/DefaultSensorStorage.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/DefaultSensorStorage.java index 4f42793bf9a..0db519fc36c 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/DefaultSensorStorage.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/DefaultSensorStorage.java @@ -57,8 +57,8 @@ import org.sonar.api.batch.sensor.symbol.internal.DefaultSymbolTable; import org.sonar.api.config.Configuration; import org.sonar.api.measures.CoreMetrics; import org.sonar.api.utils.KeyValueFormat; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.core.metric.ScannerMetrics; import org.sonar.core.util.CloseableIterator; import org.sonar.duplications.block.Block; @@ -83,7 +83,7 @@ import static org.sonar.api.measures.CoreMetrics.TEST_SUCCESS_DENSITY_KEY; public class DefaultSensorStorage implements SensorStorage { - private static final Logger LOG = Loggers.get(DefaultSensorStorage.class); + private static final Logger LOG = LoggerFactory.getLogger(DefaultSensorStorage.class); private static final int DEFAULT_CPD_MIN_LINES = 10; /** diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/ModuleSensorsExecutor.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/ModuleSensorsExecutor.java index 8216f3b93c0..61c9362da86 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/ModuleSensorsExecutor.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/ModuleSensorsExecutor.java @@ -24,15 +24,15 @@ import java.util.Collection; import java.util.stream.Collectors; import java.util.stream.Stream; import org.sonar.api.batch.fs.internal.SensorStrategy; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.core.util.logs.Profiler; import org.sonar.scanner.bootstrap.ScannerPluginRepository; import org.sonar.api.batch.fs.internal.DefaultInputModule; import org.sonar.scanner.fs.InputModuleHierarchy; public class ModuleSensorsExecutor { - private static final Logger LOG = Loggers.get(ModuleSensorsExecutor.class); + private static final Logger LOG = LoggerFactory.getLogger(ModuleSensorsExecutor.class); private static final Profiler profiler = Profiler.create(LOG); private final ModuleSensorExtensionDictionary selector; private final SensorStrategy strategy; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/ProjectSensorsExecutor.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/ProjectSensorsExecutor.java index 840728c9e96..84a82e49cb6 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/ProjectSensorsExecutor.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/ProjectSensorsExecutor.java @@ -21,13 +21,13 @@ package org.sonar.scanner.sensor; import java.util.List; import java.util.stream.Collectors; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.core.util.logs.Profiler; import org.sonar.scanner.bootstrap.ScannerPluginRepository; public class ProjectSensorsExecutor { - private static final Logger LOG = Loggers.get(ProjectSensorsExecutor.class); + private static final Logger LOG = LoggerFactory.getLogger(ProjectSensorsExecutor.class); private static final Profiler profiler = Profiler.create(LOG); private final ProjectSensorExtensionDictionary selector; private final ScannerPluginRepository pluginRepo; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/UnchangedFilesHandler.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/UnchangedFilesHandler.java index 448d608b1c3..be28eeadd85 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/UnchangedFilesHandler.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/UnchangedFilesHandler.java @@ -24,12 +24,12 @@ import java.util.Set; import org.sonar.api.batch.fs.InputFile; import org.sonar.api.batch.fs.internal.DefaultInputFile; import org.sonar.api.config.Configuration; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.scanner.scan.branch.BranchConfiguration; public class UnchangedFilesHandler { - private static final Logger LOG = Loggers.get(UnchangedFilesHandler.class); + private static final Logger LOG = LoggerFactory.getLogger(UnchangedFilesHandler.class); private static final Set<SensorId> ENABLED_SENSORS = Set.of( new SensorId("cpp", "CFamily"), new SensorId("cobol", "CobolSquidSensor"), diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/util/ProgressReport.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/util/ProgressReport.java index 622a0f590ba..e969b8a62d0 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/util/ProgressReport.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/util/ProgressReport.java @@ -20,12 +20,12 @@ package org.sonar.scanner.util; import javax.annotation.Nullable; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class ProgressReport implements Runnable { - private static final Logger LOG = Loggers.get(ProgressReport.class); + private static final Logger LOG = LoggerFactory.getLogger(ProgressReport.class); private final long period; private long startTime; private String message = ""; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scm/git/GitScmProvider.java b/sonar-scanner-engine/src/main/java/org/sonar/scm/git/GitScmProvider.java index cd287270a68..0d6a27c8785 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scm/git/GitScmProvider.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scm/git/GitScmProvider.java @@ -68,8 +68,8 @@ import org.sonar.api.batch.scm.ScmProvider; import org.sonar.api.notifications.AnalysisWarnings; import org.sonar.api.utils.MessageException; import org.sonar.api.utils.System2; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.core.documentation.DocumentationLinkGenerator; import static java.lang.String.format; @@ -83,7 +83,7 @@ import static org.eclipse.jgit.diff.DiffEntry.ChangeType.RENAME; public class GitScmProvider extends ScmProvider { - private static final Logger LOG = Loggers.get(GitScmProvider.class); + private static final Logger LOG = LoggerFactory.getLogger(GitScmProvider.class); private static final String COULD_NOT_FIND_REF = "Could not find ref '%s' in refs/heads, refs/remotes, refs/remotes/upstream or refs/remotes/origin"; private static final String NO_MERGE_BASE_FOUND_MESSAGE = "No merge base found between HEAD and %s"; @VisibleForTesting diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scm/git/IncludedFilesRepository.java b/sonar-scanner-engine/src/main/java/org/sonar/scm/git/IncludedFilesRepository.java index 3d8bf724e69..e808d1525f3 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scm/git/IncludedFilesRepository.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scm/git/IncludedFilesRepository.java @@ -29,12 +29,12 @@ import org.eclipse.jgit.treewalk.FileTreeIterator; import org.eclipse.jgit.treewalk.TreeWalk; import org.eclipse.jgit.treewalk.WorkingTreeIterator; import org.eclipse.jgit.treewalk.filter.PathFilterGroup; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class IncludedFilesRepository { - private static final Logger LOG = Loggers.get(IncludedFilesRepository.class); + private static final Logger LOG = LoggerFactory.getLogger(IncludedFilesRepository.class); private final Set<Path> includedFiles = new HashSet<>(); public IncludedFilesRepository(Path baseDir) throws IOException { diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scm/git/JGitBlameCommand.java b/sonar-scanner-engine/src/main/java/org/sonar/scm/git/JGitBlameCommand.java index a544f4af668..6624ca849e5 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scm/git/JGitBlameCommand.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scm/git/JGitBlameCommand.java @@ -25,13 +25,13 @@ import org.eclipse.jgit.api.Git; import org.eclipse.jgit.blame.BlameResult; import org.eclipse.jgit.diff.RawTextComparator; import org.sonar.api.batch.scm.BlameLine; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import static java.util.Collections.emptyList; public class JGitBlameCommand { - private static final Logger LOG = Loggers.get(JGitBlameCommand.class); + private static final Logger LOG = LoggerFactory.getLogger(JGitBlameCommand.class); public List<BlameLine> blame(Git git, String filename) { BlameResult blameResult; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scm/git/NativeGitBlameCommand.java b/sonar-scanner-engine/src/main/java/org/sonar/scm/git/NativeGitBlameCommand.java index 0dd2e1620ef..d69dd189cd3 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scm/git/NativeGitBlameCommand.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scm/git/NativeGitBlameCommand.java @@ -32,8 +32,8 @@ import org.apache.commons.lang.math.NumberUtils; import org.sonar.api.batch.scm.BlameLine; import org.sonar.api.utils.System2; import org.sonar.api.utils.Version; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import static java.util.Collections.emptyList; @@ -45,7 +45,7 @@ public class NativeGitBlameCommand { protected static final String GIT_DIR_ARGUMENT = "%s/.git"; protected static final String GIT_DIR_FORCE_FLAG = "-C"; - private static final Logger LOG = Loggers.get(NativeGitBlameCommand.class); + private static final Logger LOG = LoggerFactory.getLogger(NativeGitBlameCommand.class); private static final Pattern EMAIL_PATTERN = Pattern.compile("<(.*?)>"); private static final String COMMITTER_TIME = "committer-time "; private static final String AUTHOR_MAIL = "author-mail "; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scm/git/ProcessWrapperFactory.java b/sonar-scanner-engine/src/main/java/org/sonar/scm/git/ProcessWrapperFactory.java index c00b62f4b5e..a203beeef9f 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scm/git/ProcessWrapperFactory.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scm/git/ProcessWrapperFactory.java @@ -26,15 +26,15 @@ import java.nio.file.Path; import java.util.Scanner; import java.util.function.Consumer; import javax.annotation.Nullable; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import static java.lang.String.format; import static java.lang.String.join; import static java.nio.charset.StandardCharsets.UTF_8; public class ProcessWrapperFactory { - private static final Logger LOG = Loggers.get(ProcessWrapperFactory.class); + private static final Logger LOG = LoggerFactory.getLogger(ProcessWrapperFactory.class); public ProcessWrapperFactory() { // nothing to do diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scm/git/strategy/DefaultBlameStrategy.java b/sonar-scanner-engine/src/main/java/org/sonar/scm/git/strategy/DefaultBlameStrategy.java index d52aed22d0d..41813326672 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scm/git/strategy/DefaultBlameStrategy.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scm/git/strategy/DefaultBlameStrategy.java @@ -20,8 +20,8 @@ package org.sonar.scm.git.strategy; import org.sonar.api.config.Configuration; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import static org.sonar.scm.git.strategy.DefaultBlameStrategy.BlameAlgorithmEnum.*; @@ -36,7 +36,7 @@ import static org.sonar.scm.git.strategy.DefaultBlameStrategy.BlameAlgorithmEnum */ public class DefaultBlameStrategy implements BlameStrategy { - private static final Logger LOG = Loggers.get(DefaultBlameStrategy.class); + private static final Logger LOG = LoggerFactory.getLogger(DefaultBlameStrategy.class); private static final int FILES_GIT_BLAME_TRIGGER = 10; public static final String PROP_SONAR_SCM_USE_BLAME_ALGORITHM = "sonar.scm.use.blame.algorithm"; private final Configuration configuration; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scm/svn/SvnBlameCommand.java b/sonar-scanner-engine/src/main/java/org/sonar/scm/svn/SvnBlameCommand.java index a69154d7d4c..dec03ce2da7 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scm/svn/SvnBlameCommand.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scm/svn/SvnBlameCommand.java @@ -25,8 +25,8 @@ import org.sonar.api.batch.fs.FileSystem; import org.sonar.api.batch.fs.InputFile; import org.sonar.api.batch.scm.BlameCommand; import org.sonar.api.batch.scm.BlameLine; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.tmatesoft.svn.core.SVNAuthenticationException; import org.tmatesoft.svn.core.SVNErrorCode; import org.tmatesoft.svn.core.SVNException; @@ -42,7 +42,7 @@ import static org.sonar.scm.svn.SvnScmSupport.newSvnClientManager; public class SvnBlameCommand extends BlameCommand { - private static final Logger LOG = Loggers.get(SvnBlameCommand.class); + private static final Logger LOG = LoggerFactory.getLogger(SvnBlameCommand.class); private final SvnConfiguration configuration; public SvnBlameCommand(SvnConfiguration configuration) { diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scm/svn/SvnScmProvider.java b/sonar-scanner-engine/src/main/java/org/sonar/scm/svn/SvnScmProvider.java index 08d3b5fabaf..3e3016e27a8 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scm/svn/SvnScmProvider.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scm/svn/SvnScmProvider.java @@ -32,8 +32,8 @@ import java.util.Set; import javax.annotation.CheckForNull; import org.sonar.api.batch.scm.BlameCommand; import org.sonar.api.batch.scm.ScmProvider; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.tmatesoft.svn.core.SVNDepth; import org.tmatesoft.svn.core.SVNException; import org.tmatesoft.svn.core.SVNLogEntryPath; @@ -50,7 +50,7 @@ import static org.sonar.scm.svn.SvnScmSupport.newSvnClientManager; public class SvnScmProvider extends ScmProvider { - private static final Logger LOG = Loggers.get(SvnScmProvider.class); + private static final Logger LOG = LoggerFactory.getLogger(SvnScmProvider.class); private final SvnConfiguration configuration; private final SvnBlameCommand blameCommand; diff --git a/ut-monitoring/src/main/java/org/sonarqube/ut/aspects/AspectAssistant.java b/ut-monitoring/src/main/java/org/sonarqube/ut/aspects/AspectAssistant.java index 35db0f83480..bba4eba98c0 100644 --- a/ut-monitoring/src/main/java/org/sonarqube/ut/aspects/AspectAssistant.java +++ b/ut-monitoring/src/main/java/org/sonarqube/ut/aspects/AspectAssistant.java @@ -31,14 +31,14 @@ import java.time.ZoneId; import java.time.format.DateTimeFormatter; import java.util.function.Consumer; import org.aspectj.lang.ProceedingJoinPoint; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class AspectAssistant { public static final String COMMIT_HASH = System.getenv("GIT_SHA1"); public static final String BUILD_NUMBER = System.getenv("BUILD_NUMBER"); - private static final Logger LOGGER = Loggers.get(AspectAssistant.class); + private static final Logger LOGGER = LoggerFactory.getLogger(AspectAssistant.class); private static final Path PATH = Paths.get("/tmp/ut-backend-monitoring.log"); private static final Gson GSON = new Gson(); diff --git a/ut-monitoring/src/main/java/org/sonarqube/ut/aspects/RunAftersAspect.java b/ut-monitoring/src/main/java/org/sonarqube/ut/aspects/RunAftersAspect.java index fd825238683..7f55513dab2 100644 --- a/ut-monitoring/src/main/java/org/sonarqube/ut/aspects/RunAftersAspect.java +++ b/ut-monitoring/src/main/java/org/sonarqube/ut/aspects/RunAftersAspect.java @@ -30,12 +30,12 @@ import org.junit.internal.runners.statements.InvokeMethod; import org.junit.internal.runners.statements.RunAfters; import org.junit.internal.runners.statements.RunBefores; import org.junit.runners.model.FrameworkMethod; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; @Aspect("percflow(execution(void org.junit.internal.runners.statements.RunAfters.evaluate()))") public class RunAftersAspect { - private static final Logger logger = Loggers.get(RunAftersAspect.class); + private static final Logger logger = LoggerFactory.getLogger(RunAftersAspect.class); private String testClass = ""; private String testMethod = ""; diff --git a/ut-monitoring/src/main/java/org/sonarqube/ut/aspects/RunBeforesAspect.java b/ut-monitoring/src/main/java/org/sonarqube/ut/aspects/RunBeforesAspect.java index dedc84f01d5..8958d429e57 100644 --- a/ut-monitoring/src/main/java/org/sonarqube/ut/aspects/RunBeforesAspect.java +++ b/ut-monitoring/src/main/java/org/sonarqube/ut/aspects/RunBeforesAspect.java @@ -29,12 +29,12 @@ import org.aspectj.lang.annotation.Pointcut; import org.junit.internal.runners.statements.InvokeMethod; import org.junit.internal.runners.statements.RunBefores; import org.junit.runners.model.FrameworkMethod; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; @Aspect("percflow(execution(void org.junit.internal.runners.statements.RunBefores.evaluate()))") public class RunBeforesAspect { - private static final Logger logger = Loggers.get(RunBeforesAspect.class); + private static final Logger logger = LoggerFactory.getLogger(RunBeforesAspect.class); private String testClass = ""; private String testMethod = ""; |