Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BAH-3339 | Removed the log4j dependency and updated to slf4j #88

Merged
merged 6 commits into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -28,7 +28,7 @@ public class OpenERPCustomerServiceEventWorker implements EventWorker {
private final OpenMRSWebClient webClient;
private final String urlPrefix;

private static final Logger logger = LogManager.getLogger(OpenERPCustomerServiceEventWorker.class);
private static Logger logger = LoggerFactory.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.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 final Logger logger = LogManager.getLogger(OpenERPDrugServiceEventWorker.class);
private static Logger logger = LoggerFactory.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.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 final Logger logger = LogManager.getLogger(OpenERPLabOrderTypeServiceEventWorker.class);
private static Logger logger = LoggerFactory.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.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 @@ -24,7 +24,7 @@ public class OpenERPSaleOrderEventWorker implements EventWorker {
private final String urlPrefix;


private static final Logger logger = LogManager.getLogger(OpenERPSaleOrderEventWorker.class);
private static Logger logger = LoggerFactory.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.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 @@ -27,7 +27,7 @@ public class OpenERPSaleableResourceWorker implements EventWorker {
private final OpenMRSWebClient openMRSWebClient;
private final String urlPrefix;

private static final Logger logger = LogManager.getLogger(OpenERPSaleableResourceWorker.class);
private static Logger logger = LoggerFactory.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.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 @@ -21,7 +21,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, String odooURL, 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
Loading