From b25d2a824beb28fc8a5ae4bd7cb3eb8bd3413319 Mon Sep 17 00:00:00 2001 From: Jacek Date: Wed, 15 Jul 2020 09:53:53 +0200 Subject: [PATCH] SONAR-13618 Remove new lines from db migration log --- .../server/platform/DatabaseServerCompatibility.java | 9 +++++---- .../server/platform/DatabaseServerCompatibilityTest.java | 8 ++++---- 2 files changed, 9 insertions(+), 8 deletions(-) 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 edf844e9be6..8060c42036d 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 @@ -23,6 +23,7 @@ import java.util.Optional; import org.picocontainer.Startable; 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.sonar.process.ProcessProperties; import org.sonar.server.platform.db.migration.version.DatabaseVersion; @@ -58,10 +59,10 @@ 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); - Loggers.get(STARTUP_LOGGER_NAME).warn('\n' - + HIGHLIGHTER + '\n' - + " " + msg - + '\n' + HIGHLIGHTER); + Logger logger = Loggers.get(STARTUP_LOGGER_NAME); + logger.warn(HIGHLIGHTER); + logger.warn(msg); + logger.warn(HIGHLIGHTER); } } } diff --git a/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/DatabaseServerCompatibilityTest.java b/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/DatabaseServerCompatibilityTest.java index 5a1138e3338..dc08f17a70f 100644 --- a/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/DatabaseServerCompatibilityTest.java +++ b/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/DatabaseServerCompatibilityTest.java @@ -72,13 +72,13 @@ public class DatabaseServerCompatibilityTest { when(version.getVersion()).thenReturn(Optional.of(DatabaseVersion.MIN_UPGRADE_VERSION)); new DatabaseServerCompatibility(version, settings.asConfig()).start(); - assertThat(logTester.logs()).hasSize(2); + assertThat(logTester.logs()).hasSize(4); assertThat(logTester.logs(LoggerLevel.WARN)).contains( "The database must be manually upgraded. Please backup the database and browse /setup. " + "For more information: https://docs.sonarqube.org/latest/setup/upgrading", - "\n################################################################################\n" + - " The database must be manually upgraded. Please backup the database and browse /setup. " - + "For more information: https://docs.sonarqube.org/latest/setup/upgrading\n" + + "################################################################################", + "The database must be manually upgraded. Please backup the database and browse /setup. " + + "For more information: https://docs.sonarqube.org/latest/setup/upgrading", "################################################################################"); } -- 2.39.5