From 6e5ef32ec1b07d40128a9b9aaa4bdcd483e15f85 Mon Sep 17 00:00:00 2001 From: SanoferSameera <79590907+SanoferSameera@users.noreply.github.com> Date: Tue, 12 Dec 2023 12:28:07 +0530 Subject: [PATCH] Revert "BAH-3339 | Removed the log4j dependency and updated to slf4j" (#89) --- openerp-atomfeed-service/pom.xml | 20 +++++------ .../openerp/OpenERPAtomFeedProperties.java | 6 ++-- .../openerp/client/AbstractWebClient.java | 2 +- .../openerp/client/FeedClientFactory.java | 6 ++-- .../openerp/client/OpenElisWebClient.java | 6 ++-- .../feed/openerp/client/OpenMRSWebClient.java | 6 ++-- .../client/ReferenceDataWebClient.java | 6 ++-- .../controller/TaskMonitorController.java | 0 .../openerp/domain/OpenMRSPersonAddress.java | 6 ++-- .../domain/OpenMRSPersonAttributes.java | 8 ++--- .../feed/openerp/job/SimpleFeedJob.java | 6 ++-- .../OpenERPCustomerServiceEventWorker.java | 6 ++-- .../worker/OpenERPDrugServiceEventWorker.java | 6 ++-- ...OpenERPLabOrderTypeServiceEventWorker.java | 6 ++-- .../worker/OpenERPSaleOrderEventWorker.java | 6 ++-- .../worker/OpenERPSaleableResourceWorker.java | 6 ++-- .../worker/OpenElisSaleOrderEventWorker.java | 6 ++-- .../src/main/resources/log4j2.properties | 27 ++++++++++++++ .../src/main/resources/logback.xml | 29 --------------- .../src/main/webapp/WEB-INF/web.xml | 4 +-- openerp-client/pom.xml | 12 ++----- .../client/OpenERPResponseErrorValidator.java | 8 ++--- .../openerp/web/http/client/RestClient.java | 6 ++-- .../openerp/web/http/client/XMLClient.java | 6 ++-- .../web/service/CustomerAccountService.java | 0 package/docker/Dockerfile | 2 +- package/resources/logback.xml | 29 --------------- pom.xml | 36 +++++++++++++------ 28 files changed, 121 insertions(+), 146 deletions(-) delete mode 100644 openerp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/controller/TaskMonitorController.java create mode 100644 openerp-atomfeed-service/src/main/resources/log4j2.properties delete mode 100644 openerp-atomfeed-service/src/main/resources/logback.xml delete mode 100644 openerp-client/src/main/java/org/bahmni/openerp/web/service/CustomerAccountService.java delete mode 100644 package/resources/logback.xml diff --git a/openerp-atomfeed-service/pom.xml b/openerp-atomfeed-service/pom.xml index c094bbfe..76a6054d 100644 --- a/openerp-atomfeed-service/pom.xml +++ b/openerp-atomfeed-service/pom.xml @@ -161,22 +161,22 @@ jcl-over-slf4j 1.6.1 - org.slf4j - slf4j-api - 2.0.9 + slf4j-log4j12 + 1.6.0 - - ch.qos.logback - logback-classic - 1.2.6 + org.apache.logging.log4j + log4j-1.2-api - javax.annotation - javax.annotation-api - 1.3.2 + org.apache.logging.log4j + log4j-core + + + org.apache.logging.log4j + log4j-web javax.servlet diff --git a/openerp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/OpenERPAtomFeedProperties.java b/openerp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/OpenERPAtomFeedProperties.java index 25e44958..8a3c7ef2 100644 --- a/openerp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/OpenERPAtomFeedProperties.java +++ b/openerp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/OpenERPAtomFeedProperties.java @@ -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; @@ -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; diff --git a/openerp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/client/AbstractWebClient.java b/openerp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/client/AbstractWebClient.java index df7a3f63..82c6c3f4 100644 --- a/openerp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/client/AbstractWebClient.java +++ b/openerp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/client/AbstractWebClient.java @@ -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; diff --git a/openerp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/client/FeedClientFactory.java b/openerp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/client/FeedClientFactory.java index a3cfad20..70574ff2 100644 --- a/openerp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/client/FeedClientFactory.java +++ b/openerp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/client/FeedClientFactory.java @@ -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; @@ -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; diff --git a/openerp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/client/OpenElisWebClient.java b/openerp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/client/OpenElisWebClient.java index 45a696d6..9aa35cc0 100644 --- a/openerp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/client/OpenElisWebClient.java +++ b/openerp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/client/OpenElisWebClient.java @@ -1,7 +1,7 @@ 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; @@ -9,7 +9,7 @@ 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); diff --git a/openerp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/client/OpenMRSWebClient.java b/openerp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/client/OpenMRSWebClient.java index a5231fd1..ab3e9147 100644 --- a/openerp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/client/OpenMRSWebClient.java +++ b/openerp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/client/OpenMRSWebClient.java @@ -1,7 +1,7 @@ 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; @@ -9,7 +9,7 @@ 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); diff --git a/openerp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/client/ReferenceDataWebClient.java b/openerp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/client/ReferenceDataWebClient.java index f5c5a1f1..78e570e5 100644 --- a/openerp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/client/ReferenceDataWebClient.java +++ b/openerp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/client/ReferenceDataWebClient.java @@ -1,7 +1,7 @@ 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; @@ -9,7 +9,7 @@ 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); diff --git a/openerp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/controller/TaskMonitorController.java b/openerp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/controller/TaskMonitorController.java deleted file mode 100644 index e69de29b..00000000 diff --git a/openerp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/domain/OpenMRSPersonAddress.java b/openerp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/domain/OpenMRSPersonAddress.java index c80a6633..6b49f543 100644 --- a/openerp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/domain/OpenMRSPersonAddress.java +++ b/openerp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/domain/OpenMRSPersonAddress.java @@ -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; @@ -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; diff --git a/openerp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/domain/OpenMRSPersonAttributes.java b/openerp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/domain/OpenMRSPersonAttributes.java index 7ee1ba33..a346ebe9 100644 --- a/openerp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/domain/OpenMRSPersonAttributes.java +++ b/openerp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/domain/OpenMRSPersonAttributes.java @@ -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; @@ -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()); } @@ -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()); } diff --git a/openerp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/job/SimpleFeedJob.java b/openerp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/job/SimpleFeedJob.java index b73eac52..63e98f1a 100644 --- a/openerp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/job/SimpleFeedJob.java +++ b/openerp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/job/SimpleFeedJob.java @@ -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; diff --git a/openerp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/worker/OpenERPCustomerServiceEventWorker.java b/openerp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/worker/OpenERPCustomerServiceEventWorker.java index 0ee4ff7a..1bc7dd2e 100644 --- a/openerp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/worker/OpenERPCustomerServiceEventWorker.java +++ b/openerp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/worker/OpenERPCustomerServiceEventWorker.java @@ -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; @@ -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; diff --git a/openerp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/worker/OpenERPDrugServiceEventWorker.java b/openerp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/worker/OpenERPDrugServiceEventWorker.java index 7bfdc202..aa78fa11 100644 --- a/openerp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/worker/OpenERPDrugServiceEventWorker.java +++ b/openerp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/worker/OpenERPDrugServiceEventWorker.java @@ -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; @@ -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; diff --git a/openerp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/worker/OpenERPLabOrderTypeServiceEventWorker.java b/openerp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/worker/OpenERPLabOrderTypeServiceEventWorker.java index 67d3c7f1..6c9f77c2 100644 --- a/openerp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/worker/OpenERPLabOrderTypeServiceEventWorker.java +++ b/openerp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/worker/OpenERPLabOrderTypeServiceEventWorker.java @@ -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; @@ -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; diff --git a/openerp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/worker/OpenERPSaleOrderEventWorker.java b/openerp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/worker/OpenERPSaleOrderEventWorker.java index 490d129e..e3dc03a8 100644 --- a/openerp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/worker/OpenERPSaleOrderEventWorker.java +++ b/openerp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/worker/OpenERPSaleOrderEventWorker.java @@ -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; @@ -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; diff --git a/openerp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/worker/OpenERPSaleableResourceWorker.java b/openerp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/worker/OpenERPSaleableResourceWorker.java index 585c811a..b3042dab 100644 --- a/openerp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/worker/OpenERPSaleableResourceWorker.java +++ b/openerp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/worker/OpenERPSaleableResourceWorker.java @@ -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; @@ -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; diff --git a/openerp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/worker/OpenElisSaleOrderEventWorker.java b/openerp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/worker/OpenElisSaleOrderEventWorker.java index 73304f11..a1b45ab7 100644 --- a/openerp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/worker/OpenElisSaleOrderEventWorker.java +++ b/openerp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/worker/OpenElisSaleOrderEventWorker.java @@ -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; @@ -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; diff --git a/openerp-atomfeed-service/src/main/resources/log4j2.properties b/openerp-atomfeed-service/src/main/resources/log4j2.properties new file mode 100644 index 00000000..af1d97b4 --- /dev/null +++ b/openerp-atomfeed-service/src/main/resources/log4j2.properties @@ -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 \ No newline at end of file diff --git a/openerp-atomfeed-service/src/main/resources/logback.xml b/openerp-atomfeed-service/src/main/resources/logback.xml deleted file mode 100644 index 9ab20339..00000000 --- a/openerp-atomfeed-service/src/main/resources/logback.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - ${basePath}/logs/openerp-feed-service.log - - ${basePath}/logs/openerp-feed-service-%d{MM-dd-yyyy}-%i.log - 5000KB - 10 - - - %d %-5p [openerp-atomfeed-service][%c] %m%n - - - - - SYSTEM_OUT - - %d %-5p [openerp-atomfeed-service][%c] %m%n - - - - - - - - - diff --git a/openerp-atomfeed-service/src/main/webapp/WEB-INF/web.xml b/openerp-atomfeed-service/src/main/webapp/WEB-INF/web.xml index 84d13984..f643bd59 100644 --- a/openerp-atomfeed-service/src/main/webapp/WEB-INF/web.xml +++ b/openerp-atomfeed-service/src/main/webapp/WEB-INF/web.xml @@ -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"> OpenERP Feed Service - - ch.qos.logback.classic.servlet.LogbackServletContextListener + org.apache.logging.log4j.web.Log4jServletContextListener - org.springframework.web.context.ContextLoaderListener diff --git a/openerp-client/pom.xml b/openerp-client/pom.xml index a1e7ecf6..2290b754 100644 --- a/openerp-client/pom.xml +++ b/openerp-client/pom.xml @@ -161,17 +161,9 @@ - org.slf4j - slf4j-api - 2.0.9 + org.apache.logging.log4j + log4j-web - - - ch.qos.logback - logback-classic - 1.2.6 - - javax.servlet javax.servlet-api diff --git a/openerp-client/src/main/java/org/bahmni/openerp/web/client/OpenERPResponseErrorValidator.java b/openerp-client/src/main/java/org/bahmni/openerp/web/client/OpenERPResponseErrorValidator.java index e700379e..0d5e3d91 100644 --- a/openerp-client/src/main/java/org/bahmni/openerp/web/client/OpenERPResponseErrorValidator.java +++ b/openerp-client/src/main/java/org/bahmni/openerp/web/client/OpenERPResponseErrorValidator.java @@ -1,7 +1,7 @@ package org.bahmni.openerp.web.client; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.LogManager; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.NodeList; @@ -18,7 +18,7 @@ import java.io.IOException; public class OpenERPResponseErrorValidator { - private static Logger logger = LoggerFactory.getLogger(OpenERPResponseErrorValidator.class); + private static final Logger logger = LogManager.getLogger(OpenERPResponseErrorValidator.class); private static final DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance(); public void checkForError(String response) { @@ -40,7 +40,7 @@ public void checkForError(String response) { throw new RuntimeException(errorMessage.toString()); } catch (XPathExpressionException | SAXException | IOException e) { logger.error("Error while parsing OpenERP response : {}", response); - logger.error(String.valueOf(e)); + logger.error(e); throw new RuntimeException(e); } } diff --git a/openerp-client/src/main/java/org/bahmni/openerp/web/http/client/RestClient.java b/openerp-client/src/main/java/org/bahmni/openerp/web/http/client/RestClient.java index ab00550a..ead3aafb 100644 --- a/openerp-client/src/main/java/org/bahmni/openerp/web/http/client/RestClient.java +++ b/openerp-client/src/main/java/org/bahmni/openerp/web/http/client/RestClient.java @@ -2,8 +2,8 @@ import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.bahmni.openerp.web.OpenERPException; import org.bahmni.openerp.web.request.OpenERPRequest; import org.bahmni.openerp.web.request.builder.Parameter; @@ -18,7 +18,7 @@ import java.util.function.Consumer; public class RestClient { - private static final Logger logger = LoggerFactory.getLogger(RestClient.class); + private static final Logger logger = LogManager.getLogger(RestClient.class); private WebClient webClient; private String accessToken; private final String baseURL; diff --git a/openerp-client/src/main/java/org/bahmni/openerp/web/http/client/XMLClient.java b/openerp-client/src/main/java/org/bahmni/openerp/web/http/client/XMLClient.java index fdf35ca4..731032d9 100644 --- a/openerp-client/src/main/java/org/bahmni/openerp/web/http/client/XMLClient.java +++ b/openerp-client/src/main/java/org/bahmni/openerp/web/http/client/XMLClient.java @@ -1,7 +1,7 @@ package org.bahmni.openerp.web.http.client; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; @@ -13,7 +13,7 @@ @Component public class XMLClient { - private static final Logger logger = LoggerFactory.getLogger(XMLClient.class); + private static final Logger logger = LogManager.getLogger(XMLClient.class); private final RestTemplate restTemplate; private boolean isTimeoutSet; diff --git a/openerp-client/src/main/java/org/bahmni/openerp/web/service/CustomerAccountService.java b/openerp-client/src/main/java/org/bahmni/openerp/web/service/CustomerAccountService.java deleted file mode 100644 index e69de29b..00000000 diff --git a/package/docker/Dockerfile b/package/docker/Dockerfile index 3ec72105..9faef477 100644 --- a/package/docker/Dockerfile +++ b/package/docker/Dockerfile @@ -16,7 +16,7 @@ COPY openerp-atomfeed-service/target/openerp-atomfeed-service.war /etc/bahmni-er RUN mkdir -p ${WAR_DIRECTORY} RUN cd ${WAR_DIRECTORY} && jar xvf /etc/bahmni-erp-connect/openerp-atomfeed-service.war -COPY package/resources/logback.xml ${WAR_DIRECTORY}/WEB-INF/classes/ +COPY package/resources/log4j2.properties ${WAR_DIRECTORY}/WEB-INF/classes/ COPY package/docker/templates/erp-atomfeed.properties.template /opt/bahmni-erp-connect/etc/erp-atomfeed.properties.template COPY package/docker/scripts/run-liquibase.sh /opt/bahmni-erp-connect/etc/run-liquibase.sh RUN chmod +x /opt/bahmni-erp-connect/etc/run-liquibase.sh diff --git a/package/resources/logback.xml b/package/resources/logback.xml deleted file mode 100644 index 9ab20339..00000000 --- a/package/resources/logback.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - ${basePath}/logs/openerp-feed-service.log - - ${basePath}/logs/openerp-feed-service-%d{MM-dd-yyyy}-%i.log - 5000KB - 10 - - - %d %-5p [openerp-atomfeed-service][%c] %m%n - - - - - SYSTEM_OUT - - %d %-5p [openerp-atomfeed-service][%c] %m%n - - - - - - - - - diff --git a/pom.xml b/pom.xml index ca817db5..1eea9fe8 100644 --- a/pom.xml +++ b/pom.xml @@ -17,7 +17,7 @@ 5.3.30 2.2.2 2.3.2 - 1.10.2-SNAPSHOT + 1.10.1 localhost odoo @@ -31,8 +31,7 @@ 4.4.5 4.5.13 3.0.1 - 2.0.9 - 1.2.6 + 2.17.1 0.94.3 false @@ -196,6 +195,14 @@ commons-logging commons-logging + + log4j + log4j + + + org.apache.logging.log4j + log4j-core + @@ -229,16 +236,25 @@ - - org.slf4j - slf4j-api - 2.0.9 + org.apache.logging.log4j + log4j-1.2-api + ${log4j.version} + + + org.apache.logging.log4j + log4j-core + ${log4j.version} + + + org.apache.logging.log4j + log4j-web + ${log4j.version} - ch.qos.logback - logback-classic - 1.2.6 + org.apache.logging.log4j + log4j-jcl + ${log4j.version} javax.servlet