Skip to content

Commit

Permalink
Deepthi M| BAH-3339|removed the log4j dependency and updated to slf4j (
Browse files Browse the repository at this point in the history
…#79)

* Deepthi M| BAH-3339|removed the log4j dependency and updated to slf4j

* Deepthi M| BAH-3339|Updated slf4j and logback version to the latest 2.0.9 and 1.4.11 respectively

* Deepthi M| BAH-3339|Updated logback version to the 1.2.6 to fix issue with validatePR
  • Loading branch information
deepthi-mantena authored Dec 4, 2023
1 parent 5caa8d4 commit db774b0
Show file tree
Hide file tree
Showing 27 changed files with 142 additions and 117 deletions.
20 changes: 10 additions & 10 deletions openerp-atomfeed-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -161,22 +161,22 @@
<artifactId>jcl-over-slf4j</artifactId>
<version>1.6.1</version>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.0</version>
<artifactId>slf4j-api</artifactId>
<version>2.0.9</version>
</dependency>

<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-1.2-api</artifactId>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.6</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-web</artifactId>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.bahmni.feed.openerp;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.bahmni.feed.openerp.job.Jobs;
import org.bahmni.openerp.web.OpenERPProperties;
import org.springframework.beans.factory.annotation.Value;
Expand All @@ -13,7 +13,7 @@
@Component
public class OpenERPAtomFeedProperties implements OpenERPProperties {

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

@Value("${chunking.strategy}")
private String chunkingStrategy;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.bahmni.feed.openerp.client;

import org.apache.logging.log4j.Logger;
import org.slf4j.Logger;
import org.bahmni.feed.openerp.OpenERPAtomFeedProperties;
import org.bahmni.webclients.ClientCookies;
import org.bahmni.webclients.ConnectionDetails;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package org.bahmni.feed.openerp.client;

import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.bahmni.feed.openerp.FeedException;
import org.bahmni.feed.openerp.OpenERPAtomFeedProperties;
import org.bahmni.feed.openerp.job.Jobs;
Expand All @@ -25,7 +25,7 @@ public class FeedClientFactory {


private final WorkerFactory workerFactory;
private static final Logger logger = LogManager.getLogger(FeedClientFactory.class);
private static Logger logger = LoggerFactory.getLogger(FeedClientFactory.class);

public FeedClientFactory(WorkerFactory workerFactory) {
this.workerFactory = workerFactory;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package org.bahmni.feed.openerp.client;

import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.bahmni.feed.openerp.OpenERPAtomFeedProperties;
import org.bahmni.webclients.ConnectionDetails;
import org.bahmni.webclients.HttpClient;
import org.bahmni.webclients.OpenElisAuthenticator;

public class OpenElisWebClient extends AbstractWebClient {

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

public OpenElisWebClient(OpenERPAtomFeedProperties properties) {
connectionDetails = connectionDetails(properties);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package org.bahmni.feed.openerp.client;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.bahmni.feed.openerp.OpenERPAtomFeedProperties;
import org.bahmni.webclients.ConnectionDetails;
import org.bahmni.webclients.HttpClient;
import org.bahmni.webclients.openmrs.OpenMRSLoginAuthenticator;

public class OpenMRSWebClient extends AbstractWebClient {

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

public OpenMRSWebClient(OpenERPAtomFeedProperties properties) {
connectionDetails = connectionDetails(properties);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package org.bahmni.feed.openerp.client;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.bahmni.feed.openerp.OpenERPAtomFeedProperties;
import org.bahmni.webclients.AnonymousAuthenticator;
import org.bahmni.webclients.ConnectionDetails;
import org.bahmni.webclients.HttpClient;

public class ReferenceDataWebClient extends AbstractWebClient {

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

public ReferenceDataWebClient(OpenERPAtomFeedProperties properties) {
connectionDetails = connectionDetails(properties);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.bahmni.feed.openerp.domain;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.bahmni.feed.openerp.ObjectMapperRepository;
import org.bahmni.feed.openerp.worker.Jsonify;
import org.bahmni.feed.openerp.worker.OpenElisSaleOrderEventWorker;
Expand Down Expand Up @@ -93,7 +93,7 @@ public String toJsonString() {
try {
return ObjectMapperRepository.objectMapper.writeValueAsString(this) ;
} catch (IOException e) {
Logger logger = LogManager.getLogger(OpenElisSaleOrderEventWorker.class);
Logger logger = LoggerFactory.getLogger(OpenElisSaleOrderEventWorker.class);
logger.error("Unable to convert personAddress hash to json string. {}", e.getMessage());
}
return null;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.bahmni.feed.openerp.domain;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.bahmni.feed.openerp.ObjectMapperRepository;
import org.bahmni.feed.openerp.worker.Jsonify;
import org.bahmni.feed.openerp.worker.OpenElisSaleOrderEventWorker;
Expand Down Expand Up @@ -54,7 +54,7 @@ public String toJsonString() {
}
}
catch (ClassCastException e){
Logger logger = LogManager.getLogger(OpenElisSaleOrderEventWorker.class);
Logger logger = LoggerFactory.getLogger(OpenElisSaleOrderEventWorker.class);
logger.error("Unable to convert personAttributes {} to json string. {}", openMRSPersonAttribute.getValue().getClass(), e.getMessage());
}

Expand All @@ -65,7 +65,7 @@ public String toJsonString() {
try {
personAttributesJson = ObjectMapperRepository.objectMapper.writeValueAsString(personAttributes);
} catch (IOException e) {
Logger logger = LogManager.getLogger(OpenElisSaleOrderEventWorker.class);
Logger logger = LoggerFactory.getLogger(OpenElisSaleOrderEventWorker.class);
logger.error("Unable to convert personAttributes hash to json string. {}", e.getMessage());
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package org.bahmni.feed.openerp.job;

import org.apache.commons.lang3.exception.ExceptionUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.bahmni.feed.openerp.FeedException;
import org.bahmni.feed.openerp.client.AtomFeedClientHelper;
import org.ict4h.atomfeed.client.service.AtomFeedClient;

public class SimpleFeedJob {
private static Logger logger = LogManager.getLogger(SimpleFeedJob.class);
private static Logger logger = LoggerFactory.getLogger(SimpleFeedJob.class);

private AtomFeedClientHelper atomFeedClientHelper;
private AtomFeedClient atomFeedClient;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package org.bahmni.feed.openerp.worker;

import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.bahmni.feed.openerp.ObjectMapperRepository;
import org.bahmni.feed.openerp.OpenMRSPatientMapper;
import org.bahmni.feed.openerp.client.OpenMRSWebClient;
Expand All @@ -27,7 +27,7 @@ public class OpenERPCustomerServiceEventWorker implements EventWorker {
private OpenMRSWebClient webClient;
private String urlPrefix;

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

public OpenERPCustomerServiceEventWorker(String feedUrl, OpenERPContext openERPContext, OpenMRSWebClient webClient, String urlPrefix) {
this.feedUrl = feedUrl;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.bahmni.feed.openerp.worker;

import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.bahmni.feed.openerp.ObjectMapperRepository;
import org.bahmni.feed.openerp.domain.OpenMRSDrug;
import org.bahmni.feed.openerp.client.OpenMRSWebClient;
Expand All @@ -18,7 +18,7 @@

public class OpenERPDrugServiceEventWorker implements EventWorker {

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

private OpenERPContext openERPContext;
private String feedUrl;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.bahmni.feed.openerp.worker;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.bahmni.feed.openerp.client.OpenMRSWebClient;
import org.bahmni.feed.openerp.domain.labOrderType.OpenMRSLabOrderTypeEvent;
import org.bahmni.feed.openerp.domain.labOrderType.OpenMRSLabPanelEvent;
Expand All @@ -19,7 +19,7 @@

public class OpenERPLabOrderTypeServiceEventWorker implements EventWorker {

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

private OpenERPContext openERPContext;
private String feedUrl;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.bahmni.feed.openerp.worker;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.bahmni.feed.openerp.ObjectMapperRepository;
import org.bahmni.feed.openerp.client.OpenMRSWebClient;
import org.bahmni.feed.openerp.domain.encounter.MapERPOrders;
Expand All @@ -23,7 +23,7 @@ public class OpenERPSaleOrderEventWorker implements EventWorker {
private String urlPrefix;


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

public OpenERPSaleOrderEventWorker(String feedUrl, OpenERPContext openERPContext, OpenMRSWebClient webClient, String urlPrefix) {
this.feedUrl = feedUrl;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.bahmni.feed.openerp.worker;

import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.bahmni.feed.openerp.ObjectMapperRepository;
import org.bahmni.feed.openerp.client.OpenMRSWebClient;
import org.bahmni.feed.openerp.domain.OpenMRSResource;
Expand All @@ -26,7 +26,7 @@ public class OpenERPSaleableResourceWorker implements EventWorker {
private OpenMRSWebClient openMRSWebClient;
private String urlPrefix;

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

public OpenERPSaleableResourceWorker(String feedUrl, OpenERPContext openERPContext, OpenMRSWebClient openMRSWebClient, String urlPrefix) {
this.openERPContext = openERPContext;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.bahmni.feed.openerp.worker;

import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.bahmni.feed.openerp.ObjectMapperRepository;
import org.bahmni.feed.openerp.client.OpenElisWebClient;
import org.bahmni.feed.openerp.domain.openelis.OpenElisLabOrder;
Expand All @@ -20,7 +20,7 @@ public class OpenElisSaleOrderEventWorker implements EventWorker {
private final OpenElisWebClient webClient;
private final String urlPrefix;

private static final Logger logger = LogManager.getLogger(OpenElisSaleOrderEventWorker.class);
private static Logger logger = LoggerFactory.getLogger(OpenElisSaleOrderEventWorker.class);

public OpenElisSaleOrderEventWorker(String feedUrl, OpenERPContext openERPContext, OpenElisWebClient webClient, String urlPrefix) {
this.feedUrl = feedUrl;
Expand Down
27 changes: 0 additions & 27 deletions openerp-atomfeed-service/src/main/resources/log4j2.properties

This file was deleted.

29 changes: 29 additions & 0 deletions openerp-atomfeed-service/src/main/resources/logback.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<configuration>

<property name="basePath" value="${sys:catalina.base}" />

<appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${basePath}/logs/openerp-feed-service.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${basePath}/logs/openerp-feed-service-%d{MM-dd-yyyy}-%i.log</fileNamePattern>
<maxFileSize>5000KB</maxFileSize>
<maxHistory>10</maxHistory>
</rollingPolicy>
<encoder>
<pattern>%d %-5p [openerp-atomfeed-service][%c] %m%n</pattern>
</encoder>
</appender>

<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<target>SYSTEM_OUT</target>
<encoder>
<pattern>%d %-5p [openerp-atomfeed-service][%c] %m%n</pattern>
</encoder>
</appender>

<root level="INFO">
<appender-ref ref="file" />
<appender-ref ref="console" />
</root>

</configuration>
4 changes: 3 additions & 1 deletion openerp-atomfeed-service/src/main/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>OpenERP Feed Service</display-name>


<listener>
<listener-class>org.apache.logging.log4j.web.Log4jServletContextListener</listener-class>
<listener-class>ch.qos.logback.classic.servlet.LogbackServletContextListener</listener-class>
</listener>

<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
Expand Down
Loading

0 comments on commit db774b0

Please sign in to comment.