From 9ee60949d3ceca3ab1fcf47c9214f7bf6baf89c6 Mon Sep 17 00:00:00 2001 From: amohamad Date: Fri, 26 Jun 2020 12:40:11 -0400 Subject: Upgrade Vulnerable Direct Dependencies [log4j] Signed-off-by: amohamad Issue-ID: SDC-3051 Upgrade from the vulnerable log4j 1.x to log4j 2.13.1 Add a log4j version property in sdc-main pom.xml Add two maven dependencies to respective child pom.xml Change name of log4j .properties and .xml config files to reflect log4j2 naming Update the configuration files to the totally new log4j 2 config syntax Replace PropertyConfigurator with LoggerContext Remove the abandoned log4j.lf5.util.ResourceUtils Signed-off-by: amohamad Change-Id: Ie0f141eb2e0337ee5b63b61dc1395ccd8040558d --- catalog-dao/src/test/resources/log4j.properties | 8 ---- catalog-dao/src/test/resources/log4j2.properties | 13 ++++++ pom.xml | 1 + sdc-os-chef/scripts/docker_run.sh | 2 +- test-apis-ci/pom.xml | 6 +-- .../files/default/conf/log4j.properties | 34 ---------------- .../files/default/conf/log4j2.properties | 46 ++++++++++++++++++++++ .../sdc-api-tests/files/default/startTest.sh | 2 +- .../sdc/ci/tests/api/ComponentBaseTest.java | 5 ++- .../ci/tests/execute/lifecycle/LCSbaseTest.java | 4 +- .../ci/tests/execute/product/ProductTestBase.java | 4 +- .../preRequisites/DownloadArtifactBaseTest.java | 4 +- .../preRequisites/SimpleOneRsrcOneServiceTest.java | 4 +- .../org/openecomp/sdc/ci/tests/run/StartTest.java | 11 ++++-- .../sdc/ci/tests/run/StartTest2backup.java | 12 ++++-- .../org/openecomp/sdc/ci/tests/utils/Utils.java | 5 ++- .../sdc/ci/tests/utils/rest/ResponseParser.java | 5 ++- .../utils/validation/AuditValidationUtils.java | 7 ++-- .../utils/validation/ProductValidationUtils.java | 5 ++- .../src/main/resources/ci/conf/log4j.properties | 34 ---------------- test-apis-ci/src/main/resources/ci/conf/log4j.xml | 32 --------------- .../src/main/resources/ci/conf/log4j2.properties | 46 ++++++++++++++++++++++ test-apis-ci/src/main/resources/ci/conf/log4j2.xml | 13 ++++++ .../src/main/resources/ci/scripts/startTest.sh | 2 +- test-apis-ci/src/main/resources/log4j.properties | 34 ---------------- test-apis-ci/src/main/resources/log4j.xml | 32 --------------- test-apis-ci/src/main/resources/log4j2.properties | 46 ++++++++++++++++++++++ test-apis-ci/src/main/resources/log4j2.xml | 13 ++++++ .../files/default/conf/log4j.properties | 34 ---------------- .../files/default/conf/log4j2.properties | 46 ++++++++++++++++++++++ .../sdc-ui-tests/files/default/startTest.sh | 2 +- ui-ci/src/main/resources/ci/conf/log4j.properties | 34 ---------------- ui-ci/src/main/resources/ci/conf/log4j2.properties | 46 ++++++++++++++++++++++ ui-ci/src/main/resources/ci/scripts/startTest.sh | 2 +- utils/webseal-simulator/pom.xml | 6 +-- .../sdc-simulator/files/default/log4j.properties | 26 ------------ .../sdc-simulator/files/default/log4j2.properties | 36 +++++++++++++++++ .../recipes/SDC_Simulator_3_logback.rb | 6 +-- .../openecomp/sdc/webseal/simulator/SdcProxy.java | 5 ++- 39 files changed, 363 insertions(+), 310 deletions(-) delete mode 100644 catalog-dao/src/test/resources/log4j.properties create mode 100644 catalog-dao/src/test/resources/log4j2.properties delete mode 100644 test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/conf/log4j.properties create mode 100644 test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/conf/log4j2.properties delete mode 100644 test-apis-ci/src/main/resources/ci/conf/log4j.properties delete mode 100644 test-apis-ci/src/main/resources/ci/conf/log4j.xml create mode 100644 test-apis-ci/src/main/resources/ci/conf/log4j2.properties create mode 100644 test-apis-ci/src/main/resources/ci/conf/log4j2.xml delete mode 100644 test-apis-ci/src/main/resources/log4j.properties delete mode 100644 test-apis-ci/src/main/resources/log4j.xml create mode 100644 test-apis-ci/src/main/resources/log4j2.properties create mode 100644 test-apis-ci/src/main/resources/log4j2.xml delete mode 100644 ui-ci/sdc-ui-tests/chef-repo/cookbooks/sdc-ui-tests/files/default/conf/log4j.properties create mode 100644 ui-ci/sdc-ui-tests/chef-repo/cookbooks/sdc-ui-tests/files/default/conf/log4j2.properties delete mode 100644 ui-ci/src/main/resources/ci/conf/log4j.properties create mode 100644 ui-ci/src/main/resources/ci/conf/log4j2.properties delete mode 100644 utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/files/default/log4j.properties create mode 100644 utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/files/default/log4j2.properties diff --git a/catalog-dao/src/test/resources/log4j.properties b/catalog-dao/src/test/resources/log4j.properties deleted file mode 100644 index c18c3daa0e..0000000000 --- a/catalog-dao/src/test/resources/log4j.properties +++ /dev/null @@ -1,8 +0,0 @@ -# Root logger option -log4j.rootLogger=info, stdout - -# Direct log messages to stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.Target=System.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n diff --git a/catalog-dao/src/test/resources/log4j2.properties b/catalog-dao/src/test/resources/log4j2.properties new file mode 100644 index 0000000000..f028cd07c8 --- /dev/null +++ b/catalog-dao/src/test/resources/log4j2.properties @@ -0,0 +1,13 @@ +status = error +dest = err +name = PropertiesConfig + +appender.console.type = Console +appender.console.name = STDOUT +appender.console.layout.type = PatternLayout +appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n +appender.console.filter.threshold.type = ThresholdFilter +appender.console.filter.threshold.level = info + +rootLogger.level = info +rootLogger.appenderRef.stdout.ref = STDOUT \ No newline at end of file diff --git a/pom.xml b/pom.xml index 9bbb733c71..52328783d5 100644 --- a/pom.xml +++ b/pom.xml @@ -87,6 +87,7 @@ Modifications copyright (c) 2018-2019 Nokia 1.10 1.2 3.0.6 + 2.13.1 0.20.1 diff --git a/sdc-os-chef/scripts/docker_run.sh b/sdc-os-chef/scripts/docker_run.sh index 7880578ae4..5ea66527ec 100755 --- a/sdc-os-chef/scripts/docker_run.sh +++ b/sdc-os-chef/scripts/docker_run.sh @@ -30,7 +30,7 @@ OS_USER="onap" BE_JAVA_OPTIONS="-Xdebug -agentlib:jdwp=transport=dt_socket,address=4000,server=y,suspend=n -Xmx1536m -Xms1536m" FE_JAVA_OPTIONS="-Xdebug -agentlib:jdwp=transport=dt_socket,address=6000,server=y,suspend=n -Xmx256m -Xms256m" ONBOARD_BE_JAVA_OPTIONS="-Xdebug -agentlib:jdwp=transport=dt_socket,address=4001,server=y,suspend=n -Xmx1g -Xms1g" -SIM_JAVA_OPTIONS=" -Xmx128m -Xms128m -Xss1m -Dlog4j.configuration=file:///${JETTY_BASE}/config/sdc-simulator/log4j.properties" +SIM_JAVA_OPTIONS=" -Xmx128m -Xms128m -Xss1m -Dlog4j.configuration=file:///${JETTY_BASE}/config/sdc-simulator/log4j2.properties" API_TESTS_JAVA_OPTIONS="-Xmx512m -Xms512m" UI_TESTS_JAVA_OPTIONS="-Xmx1024m -Xms1024m" #Define this as variable, so it can be excluded in run commands on Docker for OSX, as /etc/localtime cant be mounted there. diff --git a/test-apis-ci/pom.xml b/test-apis-ci/pom.xml index 4d1b8c4795..2ae8752423 100644 --- a/test-apis-ci/pom.xml +++ b/test-apis-ci/pom.xml @@ -79,9 +79,9 @@ - log4j - log4j - 1.2.17 + org.apache.logging.log4j + log4j-core + ${log4j.version} compile diff --git a/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/conf/log4j.properties b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/conf/log4j.properties deleted file mode 100644 index 02f783076a..0000000000 --- a/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/conf/log4j.properties +++ /dev/null @@ -1,34 +0,0 @@ -# Define the root logger with appender file -log4j.rootLogger = INFO, FILE, stdout - -# Define the file appender -log4j.appender.FILE=org.apache.log4j.RollingFileAppender -log4j.appender.FILE.File=${targetlog}logs/ci-log.out - -# Define the layout for file appender -log4j.appender.FILE.layout=org.apache.log4j.PatternLayout -log4j.appender.FILE.layout.conversionPattern=%d{yyyy-MM-dd HH:mm:ss} %5p [%10c] : %m%n - -# Set the maximum file size before rollover -log4j.appender.FILE.maxFileSize=5MB - -# Set the the backup index -log4j.appender.FILE.maxBackupIndex=10 - - -############################################################# - -# Direct log messages to stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.Target=System.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -#log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n -log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %5p %10c:%L - %m%n - -log4j.logger.org.apache.cassandra.service.StorageProxy=INFO -log4j.logger.org.janusgraph.diskstorage.cassandra.CassandraTransaction=INFO, FILE, stdout - -log4j.logger.org.openecomp.sdc.ci.tests.utils=INFO, FILE, stdout -log4j.additivity.org.openecomp.sdc.ci.tests.utils=false - - diff --git a/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/conf/log4j2.properties b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/conf/log4j2.properties new file mode 100644 index 0000000000..a0ed4f0c42 --- /dev/null +++ b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/conf/log4j2.properties @@ -0,0 +1,46 @@ +status = error +dest = err +name = PropertiesConfig + +property.filename = ${targetlog}logs/ci-log.out + +#filter.threshold.type = ThresholdFilter +#filter.threshold.level = debug + +appender.rolling.type = RollingFile +appender.rolling.name = RollingFile +appender.rolling.fileName = ${filename} +appender.rolling.filePattern = ${targetlog}logs/ci-%d{MM-dd-yy-HH-mm-ss}-%i.log.gz +appender.rolling.layout.type = PatternLayout +appender.rolling.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %5p [%10c] : %m%n +appender.rolling.policies.type = Policies +appender.rolling.policies.size.type = SizeBasedTriggeringPolicy +appender.rolling.policies.size.size=5MB +appender.rolling.strategy.type = DefaultRolloverStrategy +appender.rolling.strategy.max = 10 + +appender.console.type = Console +appender.console.name = STDOUT +appender.console.layout.type = PatternLayout +appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %5p %10c:%L - %m%n +appender.console.filter.threshold.type = ThresholdFilter +appender.console.filter.threshold.level = info + +logger.rolling.name = RollingAppender +logger.rolling.level = info +logger.rolling.additivity = false +logger.rolling.appenderRef.rolling.ref = RollingFile + +logger.org.apache.cassandra.service.StorageProxy.level=info +logger.org.janusgraph.diskstorage.cassandra.CassandraTransaction.level =info +logger.org.janusgraph.diskstorage.cassandra.CassandraTransaction.appendRef.rolling.ref = RollingFile +logger.org.janusgraph.diskstorage.cassandra.CassandraTransaction.appendRef.stdout.ref = STDOUT + +logger.org.openecomp.sdc.ci.tests.utils.level = info +logger.org.openecomp.sdc.ci.tests.utils.appendRef.rolling.ref = RollingFile +logger.org.openecomp.sdc.ci.tests.utils.appendRef.stdout.ref = STDOUT +logger.org.openecomp.sdc.ci.tests.utils.additivity = false + +rootLogger.level = info +rootLogger.appenderRef.stdout.ref = STDOUT +rootLogger.appenderRef.rolling.ref = RollingFile \ No newline at end of file diff --git a/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/startTest.sh b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/startTest.sh index 562bfe4ffc..a5ad7e239a 100644 --- a/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/startTest.sh +++ b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/startTest.sh @@ -93,7 +93,7 @@ then else FULL_PATH=$CURRENT_DIR/$BASEDIR fi -LOGS_PROP_FILE=file:${FULL_PATH}/conf/log4j.properties +LOGS_PROP_FILE=file:${FULL_PATH}/conf/log4j2.properties ############################################# TARGET_DIR=${FULL_PATH}/target CONF_FILE=${FULL_PATH}/conf/sdc.yaml diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ComponentBaseTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ComponentBaseTest.java index 8f6d9db4c2..beef13afc6 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ComponentBaseTest.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ComponentBaseTest.java @@ -26,7 +26,8 @@ import com.aventstack.extentreports.ExtentTest; import com.aventstack.extentreports.Status; import org.janusgraph.core.JanusGraph; import org.apache.commons.collections.CollectionUtils; -import org.apache.log4j.Logger; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.junit.rules.TestName; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; @@ -62,7 +63,7 @@ import static org.testng.AssertJUnit.assertNotNull; public abstract class ComponentBaseTest { - protected static Logger logger = Logger.getLogger(ComponentBaseTest.class); + protected static Logger logger = LogManager.getLogger(ComponentBaseTest.class); protected static final String REPORT_FOLDER = "." + File.separator + "ExtentReport" + File.separator; private static final String VERSIONS_INFO_FILE_NAME = "versions.info"; diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/lifecycle/LCSbaseTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/lifecycle/LCSbaseTest.java index 358e425cc5..b623aea33b 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/lifecycle/LCSbaseTest.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/lifecycle/LCSbaseTest.java @@ -20,7 +20,7 @@ package org.openecomp.sdc.ci.tests.execute.lifecycle; -import org.apache.log4j.lf5.util.ResourceUtils; + import org.junit.rules.TestName; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.model.LifecycleStateEnum; @@ -71,7 +71,7 @@ public abstract class LCSbaseTest extends ComponentBaseTest { protected ArtifactReqDetails heatNetArtifactDetails; protected ArtifactReqDetails defaultArtifactDetails; - protected ResourceUtils resourceUtils; + protected ArtifactUtils artifactUtils; // protected static ServiceUtils serviceUtils = new ServiceUtils(); diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductTestBase.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductTestBase.java index fd59f8ed33..2b62a558ab 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductTestBase.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductTestBase.java @@ -20,7 +20,7 @@ package org.openecomp.sdc.ci.tests.execute.product; -import org.apache.log4j.lf5.util.ResourceUtils; + import org.junit.Before; import org.junit.rules.TestName; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; @@ -53,7 +53,7 @@ public class ProductTestBase extends ProductBaseTest { protected User sdncUserDetails; protected ArtifactReqDetails heatArtifactDetails; protected ArtifactReqDetails defaultArtifactDetails; - protected ResourceUtils resourceUtils; + protected ArtifactUtils artifactUtils; protected Resource resource; protected Service service; diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/preRequisites/DownloadArtifactBaseTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/preRequisites/DownloadArtifactBaseTest.java index a512206035..b02f211767 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/preRequisites/DownloadArtifactBaseTest.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/preRequisites/DownloadArtifactBaseTest.java @@ -20,7 +20,7 @@ package org.openecomp.sdc.ci.tests.preRequisites; -import org.apache.log4j.lf5.util.ResourceUtils; + import org.junit.rules.TestName; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.model.Service; @@ -53,7 +53,7 @@ public class DownloadArtifactBaseTest extends ComponentBaseTest { protected ArtifactReqDetails heatArtifactDetails; protected ArtifactReqDetails defaultArtifactDetails; - protected ResourceUtils resourceUtils; + protected ArtifactUtils artifactUtils; protected Service service; diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/preRequisites/SimpleOneRsrcOneServiceTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/preRequisites/SimpleOneRsrcOneServiceTest.java index 319109a604..913b2852ac 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/preRequisites/SimpleOneRsrcOneServiceTest.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/preRequisites/SimpleOneRsrcOneServiceTest.java @@ -20,7 +20,7 @@ package org.openecomp.sdc.ci.tests.preRequisites; -import org.apache.log4j.lf5.util.ResourceUtils; + import org.junit.rules.TestName; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.ci.tests.api.ComponentBaseTest; @@ -57,7 +57,7 @@ public abstract class SimpleOneRsrcOneServiceTest extends ComponentBaseTest { protected User sdncDesignerDetails; protected ArtifactReqDetails defaultArtifactDetails; - protected ResourceUtils resourceUtils; + protected ArtifactUtils artifactUtils; protected Utils utils; diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/run/StartTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/run/StartTest.java index c1a4e39905..4bd8f58a08 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/run/StartTest.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/run/StartTest.java @@ -20,7 +20,9 @@ package org.openecomp.sdc.ci.tests.run; -import org.apache.log4j.PropertyConfigurator; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.core.LoggerContext; import org.openecomp.sdc.ci.tests.config.Config; import org.openecomp.sdc.ci.tests.utils.Utils; import org.slf4j.Logger; @@ -99,14 +101,17 @@ public class StartTest { String log4jPropsFile = System.getProperty("log4j.configuration"); if (System.getProperty("os.name").contains("Windows")) { - String logProps = "src/main/resources/ci/conf/log4j.properties"; + String logProps = "src/main/resources/ci/conf/log4j2.properties"; if (log4jPropsFile == null) { System.setProperty("targetlog", "target/"); log4jPropsFile = logProps; } } - PropertyConfigurator.configureAndWatch(log4jPropsFile); + + LoggerContext context = (org.apache.logging.log4j.core.LoggerContext) LogManager.getContext(false); + File file = new File(log4jPropsFile); + context.setConfigLocation(file.toURI()); } } diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/run/StartTest2backup.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/run/StartTest2backup.java index bb53610802..cbaf8be40b 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/run/StartTest2backup.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/run/StartTest2backup.java @@ -20,7 +20,9 @@ package org.openecomp.sdc.ci.tests.run; -import org.apache.log4j.PropertyConfigurator; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.core.LoggerContext; import org.junit.runner.JUnitCore; import org.junit.runner.Result; import org.junit.runner.notification.Failure; @@ -113,15 +115,17 @@ public class StartTest2backup { String log4jPropsFile = System.getProperty("log4j.configuration"); if (System.getProperty("os.name").contains("Windows")) { - String logProps = "src/main/resources/ci/conf/log4j.properties"; + String logProps = "src/main/resources/ci/conf/log4j2.properties"; if (log4jPropsFile == null) { System.setProperty("targetlog", "target/"); log4jPropsFile = logProps; } } - PropertyConfigurator.configureAndWatch(log4jPropsFile); - + + LoggerContext context = (org.apache.logging.log4j.core.LoggerContext) LogManager.getContext(false); + File file = new File(log4jPropsFile); + context.setConfigLocation(file.toURI()); } } diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/Utils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/Utils.java index ea6ef62618..73e99011c3 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/Utils.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/Utils.java @@ -25,7 +25,8 @@ import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParser; import org.apache.commons.lang3.StringUtils; -import org.apache.log4j.Logger; +import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.LogManager; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.ci.tests.config.Config; import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; @@ -54,7 +55,7 @@ public final class Utils { Gson gson = new Gson(); - static Logger logger = Logger.getLogger(Utils.class.getName()); + static Logger logger = LogManager.getLogger(Utils.class); String contentTypeHeaderData = "application/json"; String acceptHeaderDate = "application/json"; diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResponseParser.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResponseParser.java index 30e54d3914..5254db84fa 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResponseParser.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResponseParser.java @@ -56,7 +56,8 @@ import com.fasterxml.jackson.databind.exc.InvalidFormatException; import com.fasterxml.jackson.databind.module.SimpleModule; import com.google.gson.*; import org.apache.commons.codec.binary.Base64; -import org.apache.log4j.Logger; +import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.LogManager; import org.json.JSONArray; import org.json.JSONException; import org.json.simple.JSONObject; @@ -118,7 +119,7 @@ public class ResponseParser { public static final String ORIGIN_TYPE = "originType"; public static final String TOSCA_RESOURCE_NAME = "toscaResourceName"; - static Logger logger = Logger.getLogger(ResponseParser.class.getName()); + static Logger logger = LogManager.getLogger(ResponseParser.class); public static String getValueFromJsonResponse(String response, String fieldName) { try { diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/AuditValidationUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/AuditValidationUtils.java index 06dbc12a99..1758fce232 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/AuditValidationUtils.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/AuditValidationUtils.java @@ -22,7 +22,8 @@ package org.openecomp.sdc.ci.tests.utils.validation; import com.datastax.driver.core.ColumnDefinitions; import com.datastax.driver.core.Row; -import org.apache.log4j.Logger; +import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.LogManager; import org.codehaus.jettison.json.JSONArray; import org.codehaus.jettison.json.JSONException; import org.codehaus.jettison.json.JSONObject; @@ -64,14 +65,14 @@ import static org.testng.AssertJUnit.assertEquals; import static org.testng.AssertJUnit.assertTrue; public class AuditValidationUtils { - protected static Logger logger = Logger.getLogger(AuditValidationUtils.class.getName()); + protected static Logger logger = LogManager.getLogger(AuditValidationUtils.class); private static final String auditKeySpaceName = "sdcaudit"; public AuditValidationUtils() { super(); StartTest.enableLogger(); - logger = Logger.getLogger(AuditValidationUtils.class.getName()); + logger = LogManager.getLogger(AuditValidationUtils.class); } diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/ProductValidationUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/ProductValidationUtils.java index 18c9f9f4c0..f2ef0826f2 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/ProductValidationUtils.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/ProductValidationUtils.java @@ -20,7 +20,8 @@ package org.openecomp.sdc.ci.tests.utils.validation; -import org.apache.log4j.Logger; +import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.LogManager; import org.json.simple.JSONArray; import org.json.simple.JSONObject; import org.json.simple.JSONValue; @@ -43,7 +44,7 @@ import static org.testng.AssertJUnit.*; public class ProductValidationUtils { - static Logger logger = Logger.getLogger(ProductValidationUtils.class.getName()); + static Logger logger = LogManager.getLogger(ProductValidationUtils.class); public static void compareExpectedAndActualProducts(Product expectedProduct, Product actualProduct) { compareExpectedAndActualProducts(expectedProduct, actualProduct, null); diff --git a/test-apis-ci/src/main/resources/ci/conf/log4j.properties b/test-apis-ci/src/main/resources/ci/conf/log4j.properties deleted file mode 100644 index 02f783076a..0000000000 --- a/test-apis-ci/src/main/resources/ci/conf/log4j.properties +++ /dev/null @@ -1,34 +0,0 @@ -# Define the root logger with appender file -log4j.rootLogger = INFO, FILE, stdout - -# Define the file appender -log4j.appender.FILE=org.apache.log4j.RollingFileAppender -log4j.appender.FILE.File=${targetlog}logs/ci-log.out - -# Define the layout for file appender -log4j.appender.FILE.layout=org.apache.log4j.PatternLayout -log4j.appender.FILE.layout.conversionPattern=%d{yyyy-MM-dd HH:mm:ss} %5p [%10c] : %m%n - -# Set the maximum file size before rollover -log4j.appender.FILE.maxFileSize=5MB - -# Set the the backup index -log4j.appender.FILE.maxBackupIndex=10 - - -############################################################# - -# Direct log messages to stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.Target=System.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -#log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n -log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %5p %10c:%L - %m%n - -log4j.logger.org.apache.cassandra.service.StorageProxy=INFO -log4j.logger.org.janusgraph.diskstorage.cassandra.CassandraTransaction=INFO, FILE, stdout - -log4j.logger.org.openecomp.sdc.ci.tests.utils=INFO, FILE, stdout -log4j.additivity.org.openecomp.sdc.ci.tests.utils=false - - diff --git a/test-apis-ci/src/main/resources/ci/conf/log4j.xml b/test-apis-ci/src/main/resources/ci/conf/log4j.xml deleted file mode 100644 index 6db233a1da..0000000000 --- a/test-apis-ci/src/main/resources/ci/conf/log4j.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/test-apis-ci/src/main/resources/ci/conf/log4j2.properties b/test-apis-ci/src/main/resources/ci/conf/log4j2.properties new file mode 100644 index 0000000000..a8944dba13 --- /dev/null +++ b/test-apis-ci/src/main/resources/ci/conf/log4j2.properties @@ -0,0 +1,46 @@ +status = error +dest = err +name = PropertiesConfig + +property.filename = ${targetlog}logs/ci-log.out + +#filter.threshold.type = ThresholdFilter +#filter.threshold.level = debug + +appender.rolling.type = RollingFile +appender.rolling.name = RollingFile +appender.rolling.fileName = ${filename} +appender.rolling.filePattern = ${targetlog}logs/ci-%d{MM-dd-yy-HH-mm-ss}-%i.log.gz +appender.rolling.layout.type = PatternLayout +appender.rolling.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %5p [%10c] : %m%n +appender.rolling.policies.type = Policies +appender.rolling.policies.size.type = SizeBasedTriggeringPolicy +appender.rolling.policies.size.size=5MB +appender.rolling.strategy.type = DefaultRolloverStrategy +appender.rolling.strategy.max = 10 + +appender.console.type = Console +appender.console.name = STDOUT +appender.console.layout.type = PatternLayout +appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %5p %10c:%L - %m%n +appender.console.filter.threshold.type = ThresholdFilter +appender.console.filter.threshold.level = info + +logger.rolling.name = RollingAppender +logger.rolling.level = info +logger.rolling.additivity = false +logger.rolling.appenderRef.rolling.ref = RollingFile + +logger.org.apache.cassandra.service.StorageProxy.level=info +logger.org.janusgraph.diskstorage.cassandra.CassandraTransaction.level =info +logger.org.janusgraph.diskstorage.cassandra.CassandraTransaction.appendRef.rolling.ref = RollingFile +logger.org.janusgraph.diskstorage.cassandra.CassandraTransaction.appendRef.stdout.ref = STDOUT + +logger.org.openecomp.sdc.ci.tests.utils.level = info +logger.org.openecomp.sdc.ci.tests.utils.appendRef.rolling.ref = RollingFile +logger.org.openecomp.sdc.ci.tests.utils.appendRef.stdout.ref = STDOUT +logger.org.openecomp.sdc.ci.tests.utils.additivity = false + +rootLogger.level = info +rootLogger.appenderRef.stdout.ref = STDOUT +rootLogger.appenderRef.rolling.ref = RollingFile diff --git a/test-apis-ci/src/main/resources/ci/conf/log4j2.xml b/test-apis-ci/src/main/resources/ci/conf/log4j2.xml new file mode 100644 index 0000000000..5295d45a47 --- /dev/null +++ b/test-apis-ci/src/main/resources/ci/conf/log4j2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/test-apis-ci/src/main/resources/ci/scripts/startTest.sh b/test-apis-ci/src/main/resources/ci/scripts/startTest.sh index 719bca4459..f8285ef506 100644 --- a/test-apis-ci/src/main/resources/ci/scripts/startTest.sh +++ b/test-apis-ci/src/main/resources/ci/scripts/startTest.sh @@ -69,7 +69,7 @@ then else FULL_PATH=$CURRENT_DIR/$BASEDIR fi -LOGS_PROP_FILE=file:${FULL_PATH}/conf/log4j.properties +LOGS_PROP_FILE=file:${FULL_PATH}/conf/log4j2.properties ############################################# TARGET_DIR=${FULL_PATH}/target CONF_FILE=${FULL_PATH}/conf/attsdc.yaml diff --git a/test-apis-ci/src/main/resources/log4j.properties b/test-apis-ci/src/main/resources/log4j.properties deleted file mode 100644 index 31c4ba091b..0000000000 --- a/test-apis-ci/src/main/resources/log4j.properties +++ /dev/null @@ -1,34 +0,0 @@ -# Define the root logger with appender file -log4j.rootLogger = INFO, FILE, stdout - -# Define the file appender -log4j.appender.FILE=org.apache.log4j.RollingFileAppender -log4j.appender.FILE.File=${targetlog}logs/ci-log.out - -# Define the layout for file appender -log4j.appender.FILE.layout=org.apache.log4j.PatternLayout -log4j.appender.FILE.layout.conversionPattern=%d{yyyy-MM-dd HH:mm:ss} %5p [%10c] : %m%n - -# Set the maximum file size before rollover -log4j.appender.FILE.maxFileSize=5MB - -# Set the the backup index -log4j.appender.FILE.maxBackupIndex=10 - - -############################################################# - -# Direct log messages to stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.Target=System.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -#log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n -log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %5p %10c:%L - %m%n - -log4j.logger.org.apache.cassandra.service.StorageProxy=INFO -log4j.logger.org.janusgraph.diskstorage.cql.CassandraTransaction=INFO, FILE, stdout - -log4j.logger.org.openecomp.sdc.ci.tests.utils=INFO, FILE, stdout -log4j.additivity.org.openecomp.sdc.ci.tests.utils=false - - diff --git a/test-apis-ci/src/main/resources/log4j.xml b/test-apis-ci/src/main/resources/log4j.xml deleted file mode 100644 index 6db233a1da..0000000000 --- a/test-apis-ci/src/main/resources/log4j.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/test-apis-ci/src/main/resources/log4j2.properties b/test-apis-ci/src/main/resources/log4j2.properties new file mode 100644 index 0000000000..242714cb78 --- /dev/null +++ b/test-apis-ci/src/main/resources/log4j2.properties @@ -0,0 +1,46 @@ +status = error +dest = err +name = PropertiesConfig + +property.filename = ${targetlog}logs/ci-log.out + +#filter.threshold.type = ThresholdFilter +#filter.threshold.level = debug + +appender.rolling.type = RollingFile +appender.rolling.name = RollingFile +appender.rolling.fileName = ${filename} +appender.rolling.filePattern = ${targetlog}logs/ci-%d{MM-dd-yy-HH-mm-ss}-%i.log.gz +appender.rolling.layout.type = PatternLayout +appender.rolling.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %5p [%10c] : %m%n +appender.rolling.policies.type = Policies +appender.rolling.policies.size.type = SizeBasedTriggeringPolicy +appender.rolling.policies.size.size=5MB +appender.rolling.strategy.type = DefaultRolloverStrategy +appender.rolling.strategy.max = 10 + +appender.console.type = Console +appender.console.name = STDOUT +appender.console.layout.type = PatternLayout +appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %5p %10c:%L - %m%n +appender.console.filter.threshold.type = ThresholdFilter +appender.console.filter.threshold.level = info + +logger.rolling.name = RollingAppender +logger.rolling.level = info +logger.rolling.additivity = false +logger.rolling.appenderRef.rolling.ref = RollingFile + +logger.org.apache.cassandra.service.StorageProxy.level=info +logger.org.janusgraph.diskstorage.cql.CassandraTransaction.level =info +logger.org.janusgraph.diskstorage.cql.CassandraTransaction.appendRef.rolling.ref = RollingFile +logger.org.janusgraph.diskstorage.cql.CassandraTransaction.appendRef.stdout.ref = STDOUT + +logger.org.openecomp.sdc.ci.tests.utils.level = info +logger.org.openecomp.sdc.ci.tests.utils.appendRef.rolling.ref = RollingFile +logger.org.openecomp.sdc.ci.tests.utils.appendRef.stdout.ref = STDOUT +logger.org.openecomp.sdc.ci.tests.utils.additivity = false + +rootLogger.level = info +rootLogger.appenderRef.stdout.ref = STDOUT +rootLogger.appenderRef.rolling.ref = RollingFile \ No newline at end of file diff --git a/test-apis-ci/src/main/resources/log4j2.xml b/test-apis-ci/src/main/resources/log4j2.xml new file mode 100644 index 0000000000..97a07f95e0 --- /dev/null +++ b/test-apis-ci/src/main/resources/log4j2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/ui-ci/sdc-ui-tests/chef-repo/cookbooks/sdc-ui-tests/files/default/conf/log4j.properties b/ui-ci/sdc-ui-tests/chef-repo/cookbooks/sdc-ui-tests/files/default/conf/log4j.properties deleted file mode 100644 index 31c4ba091b..0000000000 --- a/ui-ci/sdc-ui-tests/chef-repo/cookbooks/sdc-ui-tests/files/default/conf/log4j.properties +++ /dev/null @@ -1,34 +0,0 @@ -# Define the root logger with appender file -log4j.rootLogger = INFO, FILE, stdout - -# Define the file appender -log4j.appender.FILE=org.apache.log4j.RollingFileAppender -log4j.appender.FILE.File=${targetlog}logs/ci-log.out - -# Define the layout for file appender -log4j.appender.FILE.layout=org.apache.log4j.PatternLayout -log4j.appender.FILE.layout.conversionPattern=%d{yyyy-MM-dd HH:mm:ss} %5p [%10c] : %m%n - -# Set the maximum file size before rollover -log4j.appender.FILE.maxFileSize=5MB - -# Set the the backup index -log4j.appender.FILE.maxBackupIndex=10 - - -############################################################# - -# Direct log messages to stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.Target=System.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -#log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n -log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %5p %10c:%L - %m%n - -log4j.logger.org.apache.cassandra.service.StorageProxy=INFO -log4j.logger.org.janusgraph.diskstorage.cql.CassandraTransaction=INFO, FILE, stdout - -log4j.logger.org.openecomp.sdc.ci.tests.utils=INFO, FILE, stdout -log4j.additivity.org.openecomp.sdc.ci.tests.utils=false - - diff --git a/ui-ci/sdc-ui-tests/chef-repo/cookbooks/sdc-ui-tests/files/default/conf/log4j2.properties b/ui-ci/sdc-ui-tests/chef-repo/cookbooks/sdc-ui-tests/files/default/conf/log4j2.properties new file mode 100644 index 0000000000..4735d086a0 --- /dev/null +++ b/ui-ci/sdc-ui-tests/chef-repo/cookbooks/sdc-ui-tests/files/default/conf/log4j2.properties @@ -0,0 +1,46 @@ +status = error +dest = err +name = PropertiesConfig + +property.filename = ${targetlog}logs/ci-log.out + +#filter.threshold.type = ThresholdFilter +#filter.threshold.level = debug + +appender.rolling.type = RollingFile +appender.rolling.name = RollingFile +appender.rolling.fileName = ${filename} +appender.rolling.filePattern = ${targetlog}logs/ci-%d{MM-dd-yy-HH-mm-ss}-%i.log.gz +appender.rolling.layout.type = PatternLayout +appender.rolling.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %5p [%10c] : %m%n +appender.rolling.policies.type = Policies +appender.rolling.policies.size.type = SizeBasedTriggeringPolicy +appender.rolling.policies.size.size=5MB +appender.rolling.strategy.type = DefaultRolloverStrategy +appender.rolling.strategy.max = 10 + +appender.console.type = Console +appender.console.name = STDOUT +appender.console.layout.type = PatternLayout +appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %5p %10c:%L - %m%n +appender.console.filter.threshold.type = ThresholdFilter +appender.console.filter.threshold.level = info + +logger.rolling.name = RollingAppender +logger.rolling.level = info +logger.rolling.additivity = false +logger.rolling.appenderRef.rolling.ref = RollingFile + +logger.org.apache.cassandra.service.StorageProxy.level=info +logger.org.janusgraph.diskstorage.cql.CassandraTransaction.level =info +logger.org.janusgraph.diskstorage.cql.CassandraTransaction.appendRef.rolling.ref = RollingFile +logger.org.janusgraph.diskstorage.cql.CassandraTransaction.appendRef.stdout.ref = STDOUT + +logger.org.openecomp.sdc.ci.tests.utils.level = info +logger.org.openecomp.sdc.ci.tests.utils.appendRef.rolling.ref = RollingFile +logger.org.openecomp.sdc.ci.tests.utils.appendRef.stdout.ref = STDOUT +logger.org.openecomp.sdc.ci.tests.utils.additivity = false + +rootLogger.level = info +rootLogger.appenderRef.stdout.ref = STDOUT +rootLogger.appenderRef.rolling.ref = RollingFile diff --git a/ui-ci/sdc-ui-tests/chef-repo/cookbooks/sdc-ui-tests/files/default/startTest.sh b/ui-ci/sdc-ui-tests/chef-repo/cookbooks/sdc-ui-tests/files/default/startTest.sh index c4415578ee..42153251f4 100644 --- a/ui-ci/sdc-ui-tests/chef-repo/cookbooks/sdc-ui-tests/files/default/startTest.sh +++ b/ui-ci/sdc-ui-tests/chef-repo/cookbooks/sdc-ui-tests/files/default/startTest.sh @@ -93,7 +93,7 @@ then else FULL_PATH=$CURRENT_DIR/$BASEDIR fi -LOGS_PROP_FILE=file:${FULL_PATH}/conf/log4j.properties +LOGS_PROP_FILE=file:${FULL_PATH}/conf/log4j2.properties ############################################# TARGET_DIR=${FULL_PATH}/target CONF_FILE=${FULL_PATH}/conf/sdc.yaml diff --git a/ui-ci/src/main/resources/ci/conf/log4j.properties b/ui-ci/src/main/resources/ci/conf/log4j.properties deleted file mode 100644 index 0bdf0fad8c..0000000000 --- a/ui-ci/src/main/resources/ci/conf/log4j.properties +++ /dev/null @@ -1,34 +0,0 @@ -# Define the root logger with appender file -log4j.rootLogger = DEBUG, FILE, stdout - -# Define the file appender -log4j.appender.FILE=org.apache.log4j.RollingFileAppender -log4j.appender.FILE.File=${targetlog}logs/ci-log.out - -# Define the layout for file appender -log4j.appender.FILE.layout=org.apache.log4j.PatternLayout -log4j.appender.FILE.layout.conversionPattern=%d{yyyy-MM-dd HH:mm:ss} %5p [%10c] : %m%n - -# Set the maximum file size before rollover -log4j.appender.FILE.maxFileSize=5MB - -# Set the the backup index -log4j.appender.FILE.maxBackupIndex=10 - - -############################################################# - -# Direct log messages to stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.Target=System.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -#log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n -log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %5p %10c:%L - %m%n - -log4j.logger.org.apache.cassandra.service.StorageProxy=DEBUG -log4j.logger.org.janusgraph.diskstorage.cassandra.CassandraTransaction=INFO, FILE, stdout - -log4j.logger.org.openecomp.sdc.ci.tests.utils=TRACE, FILE, stdout -log4j.additivity.org.openecomp.sdc.ci.tests.utils=false - - diff --git a/ui-ci/src/main/resources/ci/conf/log4j2.properties b/ui-ci/src/main/resources/ci/conf/log4j2.properties new file mode 100644 index 0000000000..0dde1c99c3 --- /dev/null +++ b/ui-ci/src/main/resources/ci/conf/log4j2.properties @@ -0,0 +1,46 @@ +status = error +dest = err +name = PropertiesConfig + +property.filename = ${targetlog}logs/ci-log.out + +#filter.threshold.type = ThresholdFilter +#filter.threshold.level = debug + +appender.rolling.type = RollingFile +appender.rolling.name = RollingFile +appender.rolling.fileName = ${filename} +appender.rolling.filePattern = ${targetlog}logs/ci-%d{MM-dd-yy-HH-mm-ss}-%i.log.gz +appender.rolling.layout.type = PatternLayout +appender.rolling.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %5p [%10c] : %m%n +appender.rolling.policies.type = Policies +appender.rolling.policies.size.type = SizeBasedTriggeringPolicy +appender.rolling.policies.size.size=5MB +appender.rolling.strategy.type = DefaultRolloverStrategy +appender.rolling.strategy.max = 10 + +appender.console.type = Console +appender.console.name = STDOUT +appender.console.layout.type = PatternLayout +appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %5p %10c:%L - %m%n +appender.console.filter.threshold.type = ThresholdFilter +appender.console.filter.threshold.level = info + +logger.rolling.name = RollingAppender +logger.rolling.level = info +logger.rolling.additivity = false +logger.rolling.appenderRef.rolling.ref = RollingFile + +logger.org.apache.cassandra.service.StorageProxy.level=debug +logger.org.janusgraph.diskstorage.cassandra.CassandraTransaction.level =info +logger.org.janusgraph.diskstorage.cassandra.CassandraTransaction.appendRef.rolling.ref = RollingFile +logger.org.janusgraph.diskstorage.cassandra.CassandraTransaction.appendRef.stdout.ref = STDOUT + +logger.org.openecomp.sdc.ci.tests.utils.level = trace +logger.org.openecomp.sdc.ci.tests.utils.appendRef.rolling.ref = RollingFile +logger.org.openecomp.sdc.ci.tests.utils.appendRef.stdout.ref = STDOUT +logger.org.openecomp.sdc.ci.tests.utils.additivity = false + +rootLogger.level = debug +rootLogger.appenderRef.stdout.ref = STDOUT +rootLogger.appenderRef.rolling.ref = RollingFile diff --git a/ui-ci/src/main/resources/ci/scripts/startTest.sh b/ui-ci/src/main/resources/ci/scripts/startTest.sh index 93064d0678..20afd86414 100644 --- a/ui-ci/src/main/resources/ci/scripts/startTest.sh +++ b/ui-ci/src/main/resources/ci/scripts/startTest.sh @@ -90,7 +90,7 @@ then else FULL_PATH=$CURRENT_DIR/$BASEDIR fi -LOGS_PROP_FILE=file:${FULL_PATH}/conf/log4j.properties +LOGS_PROP_FILE=file:${FULL_PATH}/conf/log4j2.properties ############################################# TARGET_DIR=${FULL_PATH}/target CONF_FILE=${FULL_PATH}/conf/attsdc.yaml diff --git a/utils/webseal-simulator/pom.xml b/utils/webseal-simulator/pom.xml index 00e84a206d..10787cc6b1 100644 --- a/utils/webseal-simulator/pom.xml +++ b/utils/webseal-simulator/pom.xml @@ -80,9 +80,9 @@ - log4j - log4j - 1.2.17 + org.apache.logging.log4j + log4j-core + ${log4j.version} compile diff --git a/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/files/default/log4j.properties b/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/files/default/log4j.properties deleted file mode 100644 index 4bf9084d14..0000000000 --- a/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/files/default/log4j.properties +++ /dev/null @@ -1,26 +0,0 @@ -# Define the root logger with appender file -log4j.rootLogger = INFO, FILE, stdout - -# Define the file appender -log4j.appender.FILE=org.apache.log4j.RollingFileAppender -log4j.appender.FILE.File=logs/ws-log.out - -# Define the layout for file appender -log4j.appender.FILE.layout=org.apache.log4j.PatternLayout -log4j.appender.FILE.layout.conversionPattern=%d{yyyy-MM-dd HH:mm:ss} %5p [%10c] : %m%n - -# Set the maximum file size before rollover -log4j.appender.FILE.maxFileSize=5MB - -# Set the the backup index -log4j.appender.FILE.maxBackupIndex=10 - - -############################################################# - -# Direct log messages to stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.Target=System.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -#log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n -log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %5p %10c:%L - %m%n diff --git a/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/files/default/log4j2.properties b/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/files/default/log4j2.properties new file mode 100644 index 0000000000..77acad8915 --- /dev/null +++ b/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/files/default/log4j2.properties @@ -0,0 +1,36 @@ +status = error +dest = err +name = PropertiesConfig + +property.filename = logs/ws-log.out + +#filter.threshold.type = ThresholdFilter +#filter.threshold.level = debug + +appender.rolling.type = RollingFile +appender.rolling.name = RollingFile +appender.rolling.fileName = ${filename} +appender.rolling.filePattern = logs/ws-%d{MM-dd-yy-HH-mm-ss}-%i.log.gz +appender.rolling.layout.type = PatternLayout +appender.rolling.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %5p [%10c] : %m%n +appender.rolling.policies.type = Policies +appender.rolling.policies.size.type = SizeBasedTriggeringPolicy +appender.rolling.policies.size.size=5MB +appender.rolling.strategy.type = DefaultRolloverStrategy +appender.rolling.strategy.max = 10 + +appender.console.type = Console +appender.console.name = STDOUT +appender.console.layout.type = PatternLayout +appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %5p %10c:%L - %m%n +appender.console.filter.threshold.type = ThresholdFilter +appender.console.filter.threshold.level = info + +logger.rolling.name = RollingAppender +logger.rolling.level = info +logger.rolling.additivity = false +logger.rolling.appenderRef.rolling.ref = RollingFile + +rootLogger.level = info +rootLogger.appenderRef.stdout.ref = STDOUT +rootLogger.appenderRef.rolling.ref = RollingFile \ No newline at end of file diff --git a/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/recipes/SDC_Simulator_3_logback.rb b/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/recipes/SDC_Simulator_3_logback.rb index 06151fe1fc..14f83c34de 100644 --- a/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/recipes/SDC_Simulator_3_logback.rb +++ b/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/recipes/SDC_Simulator_3_logback.rb @@ -1,6 +1,6 @@ -cookbook_file "log4j.properties" do - path "#{ENV['JETTY_BASE']}/config/sdc-simulator/log4j.properties" - source "log4j.properties" +cookbook_file "log4j2.properties" do + path "#{ENV['JETTY_BASE']}/config/sdc-simulator/log4j2.properties" + source "log4j2.properties" owner "jetty" group "jetty" mode "0755" diff --git a/utils/webseal-simulator/src/main/java/org/openecomp/sdc/webseal/simulator/SdcProxy.java b/utils/webseal-simulator/src/main/java/org/openecomp/sdc/webseal/simulator/SdcProxy.java index 29babc4b25..014b6c4031 100644 --- a/utils/webseal-simulator/src/main/java/org/openecomp/sdc/webseal/simulator/SdcProxy.java +++ b/utils/webseal-simulator/src/main/java/org/openecomp/sdc/webseal/simulator/SdcProxy.java @@ -35,7 +35,8 @@ import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; import org.apache.http.ssl.SSLContextBuilder; -import org.apache.log4j.Logger; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.openecomp.sdc.webseal.simulator.conf.Conf; import javax.net.ssl.SSLContext; @@ -75,7 +76,7 @@ public class SdcProxy extends HttpServlet { private static final Set RESERVED_HEADERS = Arrays.stream(ReservedHeaders.values()).map(h -> h.getValue()).collect(Collectors.toSet()); - private final static Logger logger = Logger.getLogger(SdcProxy.class); + private final static Logger logger = LogManager.getLogger(SdcProxy.class); public void init(ServletConfig config) throws ServletException { super.init(config); -- cgit 1.2.3-korg