Skip to content

Commit

Permalink
Upgrade log4j1 to 2.17.1
Browse files Browse the repository at this point in the history
  • Loading branch information
dnwick committed Jan 27, 2022
1 parent 2887598 commit 6a71646
Show file tree
Hide file tree
Showing 21 changed files with 194 additions and 101 deletions.
4 changes: 2 additions & 2 deletions component/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
<version>${json.version}</version>
</dependency>
<dependency>
<groupId>org.apache.log4j.wso2</groupId>
<artifactId>log4j</artifactId>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
</dependency>
<dependency>
<groupId>io.debezium</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
import io.siddhi.extension.io.cdc.util.CDCSourceConstants;
import io.siddhi.extension.io.cdc.util.CDCSourceUtil;
import io.siddhi.query.api.exception.SiddhiAppValidationException;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.quartz.JobKey;
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
Expand Down Expand Up @@ -429,7 +430,7 @@
}
)
public class CDCSource extends Source<CDCSource.CdcState> {
private static final Logger log = Logger.getLogger(CDCSource.class);
private static final Logger log = LogManager.getLogger(CDCSource.class);
private final ExecutorService executorService = Executors.newSingleThreadExecutor();
private int pollingInterval;
private String mode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
import org.apache.kafka.connect.connector.ConnectRecord;
import org.apache.kafka.connect.data.Struct;
import org.apache.kafka.connect.errors.DataException;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.json.JSONException;
import org.json.JSONObject;

Expand All @@ -38,7 +39,7 @@
* This class is for capturing change data for MongoDB using debezium embedded engine.
**/
public class MongoChangeDataCapture extends ChangeDataCapture {
private static final Logger log = Logger.getLogger(MongoChangeDataCapture.class);
private static final Logger log = LogManager.getLogger(MongoChangeDataCapture.class);

public MongoChangeDataCapture(String operation, SourceEventListener sourceEventListener, ListeningMetrics metrics) {
super(operation, sourceEventListener, metrics);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
import org.apache.kafka.connect.data.Field;
import org.apache.kafka.connect.data.Struct;
import org.apache.kafka.connect.errors.DataException;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import java.math.BigDecimal;
import java.util.ArrayList;
Expand All @@ -39,7 +40,7 @@
* This class is for capturing change data for RDBMS using debezium embedded engine.
**/
public class RdbmsChangeDataCapture extends ChangeDataCapture {
private static final Logger log = Logger.getLogger(RdbmsChangeDataCapture.class);
private static final Logger log = LogManager.getLogger(RdbmsChangeDataCapture.class);

public RdbmsChangeDataCapture(String operation, SourceEventListener sourceEventListener, ListeningMetrics metrics) {
super(operation, sourceEventListener, metrics);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@

package io.siddhi.extension.io.cdc.source.metrics;

import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.wso2.carbon.metrics.core.Counter;
import org.wso2.carbon.metrics.core.Level;
import org.wso2.carbon.si.metrics.core.internal.MetricsDataHolder;
Expand All @@ -31,7 +32,7 @@
*/
public class ListeningMetrics extends Metrics {

private static final Logger log = Logger.getLogger(ListeningMetrics.class);
private static final Logger log = LogManager.getLogger(ListeningMetrics.class);
private final String operationType;
private boolean isLastReceivedTimeMetricsRegistered;
private long lastReceivedTime;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@

package io.siddhi.extension.io.cdc.source.metrics;

import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.wso2.carbon.metrics.core.Counter;
import org.wso2.carbon.metrics.core.Level;
import org.wso2.carbon.si.metrics.core.internal.MetricsDataHolder;
Expand All @@ -32,7 +33,7 @@
*/
public class PollingMetrics extends Metrics {

private static final Logger log = Logger.getLogger(PollingMetrics.class);
private static final Logger log = LogManager.getLogger(PollingMetrics.class);
private final Queue<String> pollingDetails = new LinkedList<>();
private int receiveEventsPerPollingInterval;
private int pollingHistorySize;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
import io.siddhi.extension.io.cdc.source.config.CronConfiguration;
import io.siddhi.extension.io.cdc.source.polling.strategies.PollingStrategy;
import io.siddhi.extension.io.cdc.util.CDCSourceConstants;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.quartz.CronScheduleBuilder;
import org.quartz.Job;
import org.quartz.JobBuilder;
Expand All @@ -41,7 +42,7 @@
* expression then it will print the inserts and updates happened after App get started.
*/
public class CDCCronExecutor implements Job {
private static final Logger log = Logger.getLogger(CDCCronExecutor.class);
private static final Logger log = LogManager.getLogger(CDCCronExecutor.class);

public CDCCronExecutor() {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
import io.siddhi.extension.io.cdc.source.polling.strategies.WaitOnMissingRecordPollingStrategy;
import io.siddhi.extension.io.cdc.util.CDCPollingUtil;
import io.siddhi.extension.io.cdc.util.CDCSourceConstants;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.osgi.framework.BundleContext;
import org.osgi.framework.FrameworkUtil;
import org.osgi.framework.ServiceReference;
Expand All @@ -48,7 +49,7 @@
*/
public class CDCPoller implements Runnable {

private static final Logger log = Logger.getLogger(CDCPoller.class);
private static final Logger log = LogManager.getLogger(CDCPoller.class);
private String url;
private String tableName;
private String username;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
import io.siddhi.extension.io.cdc.source.metrics.PollingMetrics;
import io.siddhi.extension.io.cdc.source.polling.CDCPollingModeException;
import io.siddhi.extension.io.cdc.util.CDCPollingUtil;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import java.sql.Connection;
import java.sql.PreparedStatement;
Expand All @@ -42,7 +43,7 @@
* on.
*/
public class DefaultPollingStrategy extends PollingStrategy {
private static final Logger log = Logger.getLogger(DefaultPollingStrategy.class);
private static final Logger log = LogManager.getLogger(DefaultPollingStrategy.class);

private String pollingColumn;
private int pollingInterval;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
import io.siddhi.extension.io.cdc.util.CDCPollingUtil;
import io.siddhi.extension.io.cdc.util.CDCSourceConstants;
import io.siddhi.extension.io.cdc.util.MyYamlConstructor;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.yaml.snakeyaml.TypeDescription;
import org.yaml.snakeyaml.Yaml;

Expand All @@ -48,7 +49,7 @@
* Abstract definition of polling strategy to poll DB changes.
*/
public abstract class PollingStrategy {
private static final Logger log = Logger.getLogger(PollingStrategy.class);
private static final Logger log = LogManager.getLogger(PollingStrategy.class);
private static final String PLACE_HOLDER_TABLE_NAME = "{{TABLE_NAME}}";
private static final String PLACE_HOLDER_COLUMN_LIST = "{{COLUMN_LIST}}";
private static final String PLACE_HOLDER_CONDITION = "{{CONDITION}}";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
import io.siddhi.extension.io.cdc.source.metrics.PollingMetrics;
import io.siddhi.extension.io.cdc.source.polling.CDCPollingModeException;
import io.siddhi.extension.io.cdc.util.CDCPollingUtil;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import java.sql.Connection;
import java.sql.PreparedStatement;
Expand All @@ -42,7 +43,7 @@
* {@code pollingInterval}, {@code missedRecordRetryIntervalMS} and {@code missedRecordWaitingTimeoutMS}.
*/
public class WaitOnMissingRecordPollingStrategy extends PollingStrategy {
private static final Logger log = Logger.getLogger(WaitOnMissingRecordPollingStrategy.class);
private static final Logger log = LogManager.getLogger(WaitOnMissingRecordPollingStrategy.class);

private String pollingColumn;
private int pollingInterval;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
package io.siddhi.extension.io.cdc.util;

import io.siddhi.extension.io.cdc.source.polling.CDCPollingModeException;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import java.sql.Connection;
import java.sql.ResultSet;
Expand All @@ -32,7 +33,7 @@
* This class contains Util methods for the CDCPoller.
*/
public class CDCPollingUtil {
private static final Logger log = Logger.getLogger(CDCPollingUtil.class);
private static final Logger log = LogManager.getLogger(CDCPollingUtil.class);

/**
* Utility method which can be used to check if a given string instance is null or empty.
Expand Down
31 changes: 0 additions & 31 deletions component/src/main/resources/log4j.properties

This file was deleted.

40 changes: 40 additions & 0 deletions component/src/main/resources/log4j2.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#
# /*
# * Copyright (c) 2022, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
# *
# * WSO2 Inc. licenses this file to you under the Apache License,
# * Version 2.0 (the "License"); you may not use this file except
# * in compliance with the License.
# * You may obtain a copy of the License at
# *
# * http://www.apache.org/licenses/LICENSE-2.0
# *
# * Unless required by applicable law or agreed to in writing,
# * software distributed under the License is distributed on an
# * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# * KIND, either express or implied. See the License for the
# * specific language governing permissions and limitations
# * under the License.
# */
#


# For the general syntax of property based configuration files see the
# documenation of org.apache.log4j.PropertyConfigurator.

# The root category uses the appender called A1. Since no priority is
# specified, the root category assumes the default priority for root
# which is DEBUG in log4j. The root category is the only category that
# has a default priority. All other categories need not be assigned a
# priority in which case they inherit their priority from the
# hierarchy.

# Console appender configuration
appender.console.type = Console
appender.console.name = consoleLogger
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = [%t] %-5p %c %x - %m%n

# Root logger referring to console appender
rootLogger.level = info
rootLogger.appenderRef.stdout.ref = consoleLogger
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
import io.siddhi.core.stream.input.InputHandler;
import io.siddhi.core.stream.output.StreamCallback;
import io.siddhi.core.util.SiddhiTestHelper;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
Expand All @@ -35,7 +36,7 @@
import java.util.concurrent.atomic.AtomicInteger;

public class TestCaseOfCDCListeningMode {
private static final Logger log = Logger.getLogger(TestCaseOfCDCListeningMode.class);
private static final Logger log = LogManager.getLogger(TestCaseOfCDCListeningMode.class);
private Event currentEvent;
private AtomicInteger eventCount = new AtomicInteger(0);
private AtomicBoolean eventArrived = new AtomicBoolean(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
import io.siddhi.core.stream.input.InputHandler;
import io.siddhi.core.stream.output.StreamCallback;
import io.siddhi.core.util.SiddhiTestHelper;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
Expand All @@ -36,7 +37,7 @@

public class TestCaseOfCDCListeningModeMongo {

private static final Logger log = Logger.getLogger(TestCaseOfCDCListeningModeMongo.class);
private static final Logger log = LogManager.getLogger(TestCaseOfCDCListeningModeMongo.class);
private Event currentEvent;
private AtomicInteger eventCount = new AtomicInteger(0);
private AtomicBoolean eventArrived = new AtomicBoolean(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
import io.siddhi.core.util.SiddhiTestHelper;
import io.siddhi.core.util.persistence.InMemoryPersistenceStore;
import io.siddhi.core.util.persistence.PersistenceStore;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
Expand All @@ -40,7 +41,7 @@
import java.util.concurrent.atomic.AtomicInteger;

public class TestCaseOfCDCPollingMode {
private static final Logger log = Logger.getLogger(TestCaseOfCDCPollingMode.class);
private static final Logger log = LogManager.getLogger(TestCaseOfCDCPollingMode.class);
private Event currentEvent;
private AtomicInteger eventCount = new AtomicInteger(0);
private AtomicBoolean eventArrived = new AtomicBoolean(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
import io.siddhi.core.query.output.callback.QueryCallback;
import io.siddhi.core.util.SiddhiTestHelper;
import io.siddhi.query.api.exception.SiddhiAppValidationException;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

Expand All @@ -34,7 +35,7 @@

public class TestCaseOfCDCSourceValidation {

private static final Logger log = Logger.getLogger(TestCaseOfCDCSourceValidation.class);
private static final Logger log = LogManager.getLogger(TestCaseOfCDCSourceValidation.class);
private AtomicInteger eventCount = new AtomicInteger(0);
private AtomicBoolean eventArrived = new AtomicBoolean(false);
private int waitTime = 50;
Expand Down
Loading

0 comments on commit 6a71646

Please sign in to comment.