Skip to content

Commit

Permalink
Revert "BAH-3339 | Removed the log4j dependency and updated to slf4j" (
Browse files Browse the repository at this point in the history
  • Loading branch information
SanoferSameera authored Dec 12, 2023
1 parent ce55972 commit 6e5ef32
Show file tree
Hide file tree
Showing 28 changed files with 121 additions and 146 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-api</artifactId>
<version>2.0.9</version>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.0</version>
</dependency>

<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.6</version>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-1.2-api</artifactId>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.2</version>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-web</artifactId>
</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.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
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 = LoggerFactory.getLogger(OpenERPAtomFeedProperties.class);
private static Logger logger = LogManager.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.slf4j.Logger;
import org.apache.logging.log4j.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.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
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 Logger logger = LoggerFactory.getLogger(FeedClientFactory.class);
private static final Logger logger = LogManager.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.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
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 = LoggerFactory.getLogger(OpenElisWebClient.class);
private static Logger logger = LogManager.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.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
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 = LoggerFactory.getLogger(OpenMRSWebClient.class);
private static Logger logger = LogManager.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.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
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 = LoggerFactory.getLogger(OpenMRSWebClient.class);
private static Logger logger = LogManager.getLogger(OpenMRSWebClient.class);

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

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
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 = LoggerFactory.getLogger(OpenElisSaleOrderEventWorker.class);
Logger logger = LogManager.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.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
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 = LoggerFactory.getLogger(OpenElisSaleOrderEventWorker.class);
Logger logger = LogManager.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 = LoggerFactory.getLogger(OpenElisSaleOrderEventWorker.class);
Logger logger = LogManager.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.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
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 = LoggerFactory.getLogger(SimpleFeedJob.class);
private static Logger logger = LogManager.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.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.bahmni.feed.openerp.ObjectMapperRepository;
import org.bahmni.feed.openerp.OpenMRSPatientMapper;
import org.bahmni.feed.openerp.client.OpenMRSWebClient;
Expand All @@ -28,7 +28,7 @@ public class OpenERPCustomerServiceEventWorker implements EventWorker {
private final OpenMRSWebClient webClient;
private final String urlPrefix;

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

public OpenERPCustomerServiceEventWorker(String feedUrl, String odooURL, 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.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
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 = LoggerFactory.getLogger(OpenERPDrugServiceEventWorker.class);
private static final Logger logger = LogManager.getLogger(OpenERPDrugServiceEventWorker.class);
private final OpenERPContext openERPContext;
private final String feedUrl;
private final String odooURL;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.bahmni.feed.openerp.worker;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
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 = LoggerFactory.getLogger(OpenERPLabOrderTypeServiceEventWorker.class);
private static final Logger logger = LogManager.getLogger(OpenERPLabOrderTypeServiceEventWorker.class);
private final OpenERPContext openERPContext;
private final String feedUrl;
private final String odooURL;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.bahmni.feed.openerp.worker;

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


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

public OpenERPSaleOrderEventWorker(String feedUrl, String odooURL, 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.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.bahmni.feed.openerp.ObjectMapperRepository;
import org.bahmni.feed.openerp.client.OpenMRSWebClient;
import org.bahmni.feed.openerp.domain.OpenMRSResource;
Expand All @@ -27,7 +27,7 @@ public class OpenERPSaleableResourceWorker implements EventWorker {
private final OpenMRSWebClient openMRSWebClient;
private final String urlPrefix;

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

public OpenERPSaleableResourceWorker(String feedUrl, String odooURL, 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.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.bahmni.feed.openerp.ObjectMapperRepository;
import org.bahmni.feed.openerp.client.OpenElisWebClient;
import org.bahmni.feed.openerp.domain.openelis.OpenElisLabOrder;
Expand All @@ -21,7 +21,7 @@ public class OpenElisSaleOrderEventWorker implements EventWorker {
private final OpenElisWebClient webClient;
private final String urlPrefix;

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

public OpenElisSaleOrderEventWorker(String feedUrl, String odooURL, OpenERPContext openERPContext, OpenElisWebClient webClient, String urlPrefix) {
this.feedUrl = feedUrl;
Expand Down
27 changes: 27 additions & 0 deletions openerp-atomfeed-service/src/main/resources/log4j2.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
status = WARN

name= properties_configuration
property.basePath = ${sys:catalina.base}

appender.rolling.type = RollingFile
appender.rolling.name = file
appender.rolling.fileName= ${basePath}/logs/openerp-feed-service.log
appender.rolling.filePattern= ${basePath}/logs/openerp-feed-service-%d{MM-dd-yyyy}-%i.log
appender.rolling.layout.type = PatternLayout
appender.rolling.layout.pattern = %d %-5p [openerp-atomfeed-service][%c] %m%n
appender.rolling.policies.type = Policies

appender.rolling.policies.size.type = SizeBasedTriggeringPolicy
appender.rolling.policies.size.size = 5000KB
appender.rolling.strategy.type = DefaultRolloverStrategy
appender.rolling.strategy.max = 10

appender.console.name = console
appender.console.type = Console
appender.console.target = SYSTEM_OUT
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = %d %-5p [openerp-atomfeed-service][%c] %m%n

rootLogger.level = INFO
rootLogger.appenderRef.rolling.ref = file
rootLogger.appenderRef.console.ref = console
29 changes: 0 additions & 29 deletions openerp-atomfeed-service/src/main/resources/logback.xml

This file was deleted.

4 changes: 1 addition & 3 deletions openerp-atomfeed-service/src/main/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
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>ch.qos.logback.classic.servlet.LogbackServletContextListener</listener-class>
<listener-class>org.apache.logging.log4j.web.Log4jServletContextListener</listener-class>
</listener>

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

0 comments on commit 6e5ef32

Please sign in to comment.