Upgrade Vulnerable Direct Dependencies [log4j] 17/109617/5
authoramohamad <a.mohamad@queensu.ca>
Fri, 26 Jun 2020 16:40:11 +0000 (12:40 -0400)
committeramohamad <a.mohamad@queensu.ca>
Wed, 29 Jul 2020 19:47:42 +0000 (15:47 -0400)
Signed-off-by: amohamad <a.mohamad@queensu.ca>
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 <a.mohamad@queensu.ca>
Change-Id: Ie0f141eb2e0337ee5b63b61dc1395ccd8040558d

39 files changed:
catalog-dao/src/test/resources/log4j.properties [deleted file]
catalog-dao/src/test/resources/log4j2.properties [new file with mode: 0644]
pom.xml
sdc-os-chef/scripts/docker_run.sh
test-apis-ci/pom.xml
test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/conf/log4j.properties [deleted file]
test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/conf/log4j2.properties [new file with mode: 0644]
test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/startTest.sh
test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ComponentBaseTest.java
test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/lifecycle/LCSbaseTest.java
test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductTestBase.java
test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/preRequisites/DownloadArtifactBaseTest.java
test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/preRequisites/SimpleOneRsrcOneServiceTest.java
test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/run/StartTest.java
test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/run/StartTest2backup.java
test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/Utils.java
test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResponseParser.java
test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/AuditValidationUtils.java
test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/ProductValidationUtils.java
test-apis-ci/src/main/resources/ci/conf/log4j.properties [deleted file]
test-apis-ci/src/main/resources/ci/conf/log4j.xml [deleted file]
test-apis-ci/src/main/resources/ci/conf/log4j2.properties [new file with mode: 0644]
test-apis-ci/src/main/resources/ci/conf/log4j2.xml [new file with mode: 0644]
test-apis-ci/src/main/resources/ci/scripts/startTest.sh
test-apis-ci/src/main/resources/log4j.properties [deleted file]
test-apis-ci/src/main/resources/log4j.xml [deleted file]
test-apis-ci/src/main/resources/log4j2.properties [new file with mode: 0644]
test-apis-ci/src/main/resources/log4j2.xml [new file with mode: 0644]
ui-ci/sdc-ui-tests/chef-repo/cookbooks/sdc-ui-tests/files/default/conf/log4j.properties [deleted file]
ui-ci/sdc-ui-tests/chef-repo/cookbooks/sdc-ui-tests/files/default/conf/log4j2.properties [new file with mode: 0644]
ui-ci/sdc-ui-tests/chef-repo/cookbooks/sdc-ui-tests/files/default/startTest.sh
ui-ci/src/main/resources/ci/conf/log4j.properties [deleted file]
ui-ci/src/main/resources/ci/conf/log4j2.properties [new file with mode: 0644]
ui-ci/src/main/resources/ci/scripts/startTest.sh
utils/webseal-simulator/pom.xml
utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/files/default/log4j.properties [deleted file]
utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/files/default/log4j2.properties [new file with mode: 0644]
utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/recipes/SDC_Simulator_3_logback.rb
utils/webseal-simulator/src/main/java/org/openecomp/sdc/webseal/simulator/SdcProxy.java

diff --git a/catalog-dao/src/test/resources/log4j.properties b/catalog-dao/src/test/resources/log4j.properties
deleted file mode 100644 (file)
index c18c3da..0000000
+++ /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 (file)
index 0000000..f028cd0
--- /dev/null
@@ -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 9bbb733..5232878 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -87,6 +87,7 @@ Modifications copyright (c) 2018-2019 Nokia
     <commons-codec>1.10</commons-codec>
     <commons-logging>1.2</commons-logging>
     <janino.version>3.0.6</janino.version>
+    <log4j.version>2.13.1</log4j.version>
 
     <!-- aspects -->
     <jcabi.version>0.20.1</jcabi.version>
index 7880578..5ea6652 100755 (executable)
@@ -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.
index 4d1b8c4..2ae8752 100644 (file)
@@ -79,9 +79,9 @@
     </dependency>
 
     <dependency>
-      <groupId>log4j</groupId>
-      <artifactId>log4j</artifactId>
-      <version>1.2.17</version>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-core</artifactId>
+      <version>${log4j.version}</version>
       <scope>compile</scope>
     </dependency>
 
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 (file)
index 02f7830..0000000
+++ /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 (file)
index 0000000..a0ed4f0
--- /dev/null
@@ -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
index 562bfe4..a5ad7e2 100644 (file)
@@ -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
index 8f6d9db..beef13a 100644 (file)
@@ -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";
index 358e425..b623aea 100644 (file)
@@ -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();
index fd59f8e..2b62a55 100644 (file)
@@ -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;
index a512206..b02f211 100644 (file)
@@ -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;
 
index 319109a..913b285 100644 (file)
@@ -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;
 
index c1a4e39..4bd8f58 100644 (file)
@@ -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());
 
                }
        }
index bb53610..cbaf8be 100644 (file)
@@ -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());
                }
        }
 
index ea6ef62..73e9901 100644 (file)
@@ -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";
index 30e54d3..5254db8 100644 (file)
@@ -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 {
index 06dbc12..1758fce 100644 (file)
@@ -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);
 
        }
 
index 18c9f9f..f2ef082 100644 (file)
@@ -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 (file)
index 02f7830..0000000
+++ /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 (file)
index 6db233a..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
-
-<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"
-       debug="false">
-
-       <appender name="fileAppender" class="org.apache.log4j.FileAppender">
-
-               <param name="Threshold" value="INFO" />
-
-               <param name="File" value="logfile.log" />
-
-               <layout class="org.apache.log4j.PatternLayout">
-
-                       <param name="ConversionPattern" value="%d %-5p [%c{1}] %m %n" />
-
-               </layout>
-
-       </appender>
-
-       <root>
-
-               <level value="INFO" />
-
-               <appender-ref ref="fileAppender" />
-
-       </root>
-       
-       
-
-</log4j:configuration>
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 (file)
index 0000000..a8944db
--- /dev/null
@@ -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 (file)
index 0000000..5295d45
--- /dev/null
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Configuration status="ERROR">
+       <Appenders>
+               <File name="fileAppender" fileName="logfile.log" append="false">
+                       <PatternLayout pattern="%d %-5p [%c{1}] %m %n"/>
+               </File>
+       </Appenders>
+       <Loggers>
+               <Root level="info">
+                       <AppenderRef ref="fileAppender"/>
+               </Root>
+       </Loggers>
+</Configuration>
\ No newline at end of file
index 719bca4..f8285ef 100644 (file)
@@ -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 (file)
index 31c4ba0..0000000
+++ /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 (file)
index 6db233a..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
-
-<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"
-       debug="false">
-
-       <appender name="fileAppender" class="org.apache.log4j.FileAppender">
-
-               <param name="Threshold" value="INFO" />
-
-               <param name="File" value="logfile.log" />
-
-               <layout class="org.apache.log4j.PatternLayout">
-
-                       <param name="ConversionPattern" value="%d %-5p [%c{1}] %m %n" />
-
-               </layout>
-
-       </appender>
-
-       <root>
-
-               <level value="INFO" />
-
-               <appender-ref ref="fileAppender" />
-
-       </root>
-       
-       
-
-</log4j:configuration>
diff --git a/test-apis-ci/src/main/resources/log4j2.properties b/test-apis-ci/src/main/resources/log4j2.properties
new file mode 100644 (file)
index 0000000..242714c
--- /dev/null
@@ -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 (file)
index 0000000..97a07f9
--- /dev/null
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Configuration status="ERROR">
+<Appenders>
+       <File name="fileAppender" fileName="logfile.log" append="false">
+               <PatternLayout pattern="%d %-5p [%c{1}] %m %n"/>
+       </File>
+</Appenders>
+<Loggers>
+       <Root level="info">
+               <AppenderRef ref="fileAppender"/>
+       </Root>
+</Loggers>
+</Configuration>
\ 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 (file)
index 31c4ba0..0000000
+++ /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 (file)
index 0000000..4735d08
--- /dev/null
@@ -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
index c441557..4215325 100644 (file)
@@ -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 (file)
index 0bdf0fa..0000000
+++ /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 (file)
index 0000000..0dde1c9
--- /dev/null
@@ -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
index 93064d0..20afd86 100644 (file)
@@ -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
index 00e84a2..10787cc 100644 (file)
@@ -80,9 +80,9 @@
     </dependency>
 
     <dependency>
-      <groupId>log4j</groupId>
-      <artifactId>log4j</artifactId>
-      <version>1.2.17</version>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-core</artifactId>
+      <version>${log4j.version}</version>
       <scope>compile</scope>
     </dependency>
 
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 (file)
index 4bf9084..0000000
+++ /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 (file)
index 0000000..77acad8
--- /dev/null
@@ -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
index 06151fe..14f83c3 100644 (file)
@@ -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"
index 29babc4..014b6c4 100644 (file)
@@ -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<String> 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);