diff --git a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/applications/DeployMojoSupport.java b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/applications/DeployMojoSupport.java index 135a4272d..707c57037 100644 --- a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/applications/DeployMojoSupport.java +++ b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/applications/DeployMojoSupport.java @@ -277,7 +277,7 @@ protected void verifyAppStarted(String appFile) throws MojoExecutionException { try { Map libertyDirPropertyFiles = getLibertyDirectoryPropertyFiles(); - scd = ServerConfigDocument.getInstance(CommonLogger.getInstance(), serverXML, configDirectory, + scd = ServerConfigDocument.getInstance(new CommonLogger(log), serverXML, configDirectory, bootstrapPropertiesFile, combinedBootstrapProperties, serverEnvFile, false, libertyDirPropertyFiles); //appName will be set to a name derived from appFile if no name can be found. diff --git a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/applications/UndeployAppMojo.java b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/applications/UndeployAppMojo.java index 98436c6c6..af9370314 100644 --- a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/applications/UndeployAppMojo.java +++ b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/applications/UndeployAppMojo.java @@ -136,7 +136,7 @@ protected void undeployApp(File file) throws MojoExecutionException { File serverXML = new File(serverDirectory.getCanonicalPath(), "server.xml"); Map libertyDirPropertyFiles = getLibertyDirectoryPropertyFiles(); - scd = ServerConfigDocument.getInstance(CommonLogger.getInstance(), serverXML, configDirectory, + scd = ServerConfigDocument.getInstance(new CommonLogger(log), serverXML, configDirectory, bootstrapPropertiesFile, combinedBootstrapProperties, serverEnvFile, false, libertyDirPropertyFiles); //appName will be set to a name derived from file if no name can be found. diff --git a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/PluginConfigSupport.java b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/PluginConfigSupport.java index bf7a2fd1b..cf5c12add 100644 --- a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/PluginConfigSupport.java +++ b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/PluginConfigSupport.java @@ -316,7 +316,7 @@ protected Set getAppConfigLocationsFromSourceServerXml() { if (serverXML != null && serverXML.exists()) { try { Map libertyDirPropertyFiles = getLibertyDirectoryPropertyFiles(); - scd = ServerConfigDocument.getInstance(CommonLogger.getInstance(), serverXML, configDirectory, + scd = ServerConfigDocument.getInstance(new CommonLogger(log), serverXML, configDirectory, bootstrapPropertiesFile, combinedBootstrapProperties, serverEnvFile, false, libertyDirPropertyFiles); } catch (Exception e) { diff --git a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/utils/CommonLogger.java b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/utils/CommonLogger.java index 76f5f5e00..39b0abb49 100644 --- a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/utils/CommonLogger.java +++ b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/utils/CommonLogger.java @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corporation 2019. + * (C) Copyright IBM Corporation 2019, 2023. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,6 +15,7 @@ */ package io.openliberty.tools.maven.utils; +import org.apache.maven.plugin.logging.Log; import org.codehaus.mojo.pluginsupport.MojoSupport; import io.openliberty.tools.common.CommonLoggerI; @@ -23,11 +24,8 @@ public class CommonLogger extends MojoSupport implements CommonLoggerI { private static CommonLogger logger = null; - public static CommonLogger getInstance() { - if (logger == null) { - logger = new CommonLogger(); - } - return logger; + public CommonLogger(Log mojoLogger) { + setLog(mojoLogger); } @Override @@ -71,4 +69,4 @@ public boolean isDebugEnabled() { return getLog().isDebugEnabled(); } -} \ No newline at end of file +}