Skip to content

Commit

Permalink
BAH-1362 | Rohit, Deepthi | Upgrades log4j to the latest version 2.17…
Browse files Browse the repository at this point in the history
….1 (#11)

* BAH-1362 | Rohit, Deepthi | Upgrades log4j to the latest version 2.17.1

* BAH-1362 | Rohit, Deepthi | Keeps log4j version submodule specific

* BAH-1362 | Rohit, Deepthi | Adds provided in log4j dependency
  • Loading branch information
rohit-yawalkar authored and angshu committed Jan 21, 2022
1 parent 77b8893 commit a5e198f
Show file tree
Hide file tree
Showing 17 changed files with 95 additions and 60 deletions.
13 changes: 10 additions & 3 deletions atomfeed-client-spring/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

<properties>
<spring.version>3.1.0.RELEASE</spring.version>
<log4jVersion>2.17.1</log4jVersion>
</properties>

<repositories>
Expand Down Expand Up @@ -46,9 +47,15 @@

<dependencies>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>${log4jVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>${log4jVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down
13 changes: 10 additions & 3 deletions atomfeed-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<jdbc.username>root</jdbc.username>
<jdbc.password>admin</jdbc.password>
<jdbc.url>jdbc:h2:~/atomfeed;DATABASE_TO_UPPER=false</jdbc.url>
<log4jVersion>2.17.1</log4jVersion>
</properties>

<dependencies>
Expand All @@ -26,9 +27,15 @@
<version>1.0</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>${log4jVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>${log4jVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.ict4h.atomfeed.client;

import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

public class AtomFeedProperties {
private int readTimeout = 20000;
Expand All @@ -10,7 +11,7 @@ public class AtomFeedProperties {
private int failedEventMaxRetry = 5;
private int failedEventsBatchProcessSize = 5;

private static Logger logger = Logger.getLogger(AtomFeedProperties.class);
private static Logger logger = LogManager.getLogger(AtomFeedProperties.class);
private boolean handleRedirection = false;

public int getReadTimeout() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

import com.sun.syndication.feed.atom.Feed;
import com.sun.syndication.io.WireFeedInput;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.ict4h.atomfeed.client.exceptions.AtomFeedClientException;
import org.ict4h.atomfeed.client.AtomFeedProperties;
import org.ict4h.atomfeed.client.repository.datasource.DefaultHttpClient;
Expand All @@ -17,7 +18,7 @@ public class AllFeeds {
private AtomFeedProperties atomFeedProperties = new AtomFeedProperties();
private Map<String, String> clientCookies;

private static Logger logger = Logger.getLogger(AllFeeds.class);
private static Logger logger = LogManager.getLogger(AllFeeds.class);

protected AllFeeds() {
this.httpClient = new DefaultHttpClient();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

import com.sun.syndication.feed.atom.Category;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.ict4h.atomfeed.Configuration;
import org.ict4h.atomfeed.client.domain.Event;
import org.ict4h.atomfeed.client.domain.FailedEvent;
Expand All @@ -17,7 +18,7 @@
import java.util.List;

public class AllFailedEventsJdbcImpl implements AllFailedEvents {
private static Logger logger = Logger.getLogger(AllFailedEventsJdbcImpl.class);
private static Logger logger = LogManager.getLogger(AllFailedEventsJdbcImpl.class);
public static final String FAILED_EVENTS_TABLE = "failed_events";
public static final String FAILED_EVENT_RETRY_LOG_TABLE = "failed_event_retry_log";
public static final int ERROR_MSG_MAX_LEN = 4000;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.ict4h.atomfeed.client.repository.jdbc;

import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.ict4h.atomfeed.Configuration;
import org.ict4h.atomfeed.client.domain.Marker;
import org.ict4h.atomfeed.client.exceptions.AtomFeedClientException;
Expand All @@ -17,7 +18,7 @@
import java.util.List;

public class AllMarkersJdbcImpl implements AllMarkers {
private static Logger logger = Logger.getLogger(AllMarkersJdbcImpl.class);
private static Logger logger = LogManager.getLogger(AllMarkersJdbcImpl.class);
private JdbcConnectionProvider connectionProvider;

public AllMarkersJdbcImpl(JdbcConnectionProvider connectionProvider) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

import com.sun.syndication.feed.atom.Entry;
import com.sun.syndication.feed.atom.Feed;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.ict4h.atomfeed.client.domain.Event;
import org.ict4h.atomfeed.client.domain.FailedEvent;
import org.ict4h.atomfeed.client.domain.FailedEventRetryLog;
Expand All @@ -22,7 +23,7 @@
import java.util.List;

public class AtomFeedClient implements FeedClient {
private static Logger logger = Logger.getLogger(AtomFeedClient.class);
private static Logger logger = LogManager.getLogger(AtomFeedClient.class);

private AllFeeds allFeeds;
private AtomFeedProperties atomFeedProperties;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.sun.syndication.feed.atom.Entry;
import com.sun.syndication.feed.atom.Feed;
import org.apache.log4j.Logger;
import org.ict4h.atomfeed.client.domain.Marker;
import org.ict4h.atomfeed.client.exceptions.AtomFeedClientException;
import org.ict4h.atomfeed.client.repository.AllFeeds;
Expand All @@ -19,8 +18,6 @@ public class FeedEnumerator implements Iterable<Entry>, Iterator<Entry> {
private Feed currentFeed;
private List<Entry> entries;

private static Logger logger = Logger.getLogger(FeedEnumerator.class);

public FeedEnumerator(AllFeeds allFeeds, Marker marker) {
this.allFeeds = allFeeds;
this.marker = marker;
Expand Down
41 changes: 18 additions & 23 deletions atomfeed-client/src/test/resources/log4j.xml
Original file line number Diff line number Diff line change
@@ -1,24 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<appender name="console" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %-5p [%C{1}] %m%n" />
</layout>
</appender>

<logger name="org.springframework">
<level value="warn"/>
<appender-ref ref="console"/>
</logger>

<logger name="org.ict4h.atomfeed.client">
<level value="warn"/>
<appender-ref ref="console"/>
</logger>

<root>
<priority value="warn"/>
<appender-ref ref="console"/>
</root>
</log4j:configuration>
<Configuration>
<Appenders>
<Console name="console" target="SYSTEM_OUT">
<PatternLayout pattern="%d %-5p [%C{1}] %m%n"/>
</Console>
</Appenders>
<Loggers>
<Logger name="org.springframework" level="warn">
<AppenderRef ref="console"/>
</Logger>
<Logger name="org.ict4h.atomfeed.client" level="warn">
<AppenderRef ref="console"/>
</Logger>
<Root level="warn">
<AppenderRef ref="console"/>
</Root>
</Loggers>
</Configuration>
16 changes: 13 additions & 3 deletions atomfeed-commons/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
<artifactId>atomfeed-commons</artifactId>
<version>1.9.4</version>

<properties>
<log4jVersion>2.17.1</log4jVersion>
</properties>

<dependencies>
<dependency>
<groupId>javax.persistence</groupId>
Expand All @@ -30,9 +34,15 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>${log4jVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>${log4jVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down
16 changes: 13 additions & 3 deletions atomfeed-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
<version>1.9.4</version>
<packaging>jar</packaging>

<properties>
<log4jVersion>2.17.1</log4jVersion>
</properties>

<!--<properties>-->
<!--<db.server>localhost</db.server>-->
<!--<db.name>atomfeed</db.name>-->
Expand Down Expand Up @@ -133,9 +137,15 @@
<version>1.0</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>${log4jVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>${log4jVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.sun.syndication.feed.atom.*;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import org.ict4h.atomfeed.server.domain.EventFeed;
import org.ict4h.atomfeed.server.domain.EventRecord;
import org.ict4h.atomfeed.server.domain.EventRecordComparator;
Expand All @@ -19,7 +18,6 @@ public class EventFeedServiceImpl implements EventFeedService {
private static final String LINK_TYPE_SELF = "self";
private static final String LINK_TYPE_VIA = "via";
private static final String ATOMFEED_MEDIA_TYPE = "application/vnd.atomfeed+xml";
private final Logger logger = Logger.getLogger(this.getClass());

private FeedGenerator feedGenerator;
private ResourceBundle bundle;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.sun.syndication.feed.atom.Feed;
import com.sun.syndication.io.FeedException;
import com.sun.syndication.io.WireFeedOutput;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.Logger;
import org.ict4h.atomfeed.server.service.EventFeedService;
import org.ict4h.atomfeed.transaction.AFTransactionManager;
import org.ict4h.atomfeed.transaction.AFTransactionWork;
Expand Down
13 changes: 10 additions & 3 deletions atomfeed-spring-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

<properties>
<spring.version>3.1.0.RELEASE</spring.version>
<log4jVersion>2.17.1</log4jVersion>
</properties>

<repositories>
Expand Down Expand Up @@ -47,9 +48,15 @@

<dependencies>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>${log4jVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>${log4jVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.ict4h.atomfeed.server.transaction;

import org.apache.log4j.Logger;
import org.ict4h.atomfeed.jdbc.JdbcConnectionProvider;
import org.ict4h.atomfeed.transaction.AFTransactionManager;
import org.ict4h.atomfeed.transaction.AFTransactionWork;
Expand All @@ -18,7 +17,6 @@
import java.util.Map;

public class AtomFeedSpringTransactionSupport implements AFTransactionManager, JdbcConnectionProvider {
private static Logger logger = Logger.getLogger(AtomFeedSpringTransactionSupport.class);
private final DataSource dataSource;
private PlatformTransactionManager transactionManager;
private Map<AFTransactionWork.PropagationDefinition, Integer> propagationMap = new HashMap<AFTransactionWork.PropagationDefinition, Integer>();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.ict4h.atomfeed.spring.resource;

import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.ict4h.atomfeed.server.service.EventFeedService;
import org.ict4h.atomfeed.server.service.helper.EventFeedServiceHelper;
import org.ict4h.atomfeed.server.transaction.AtomFeedSpringTransactionSupport;
Expand All @@ -19,7 +20,7 @@
public class EventResource {
private EventFeedService eventFeedService;
private AtomFeedSpringTransactionSupport atomTxManager;
private static Logger logger = Logger.getLogger(EventResource.class);
private static Logger logger = LogManager.getLogger(EventResource.class);

@Autowired
public EventResource(EventFeedService eventFeedService, AtomFeedSpringTransactionSupport atomTxManager) {
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@
<repositories>
<repository>
<id>central</id>
<url>http://repo1.maven.org/maven2</url>
<url>https://repo1.maven.org/maven2</url>
<name>Repository for dependencies</name>
<snapshots>
<enabled>true</enabled>
Expand Down Expand Up @@ -228,7 +228,7 @@
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http://repo1.maven.org/maven2</url>
<url>https://repo1.maven.org/maven2</url>
<name>Repository for plugins</name>
</pluginRepository>
</pluginRepositories>
Expand Down

0 comments on commit a5e198f

Please sign in to comment.