Skip to content

Commit

Permalink
log4j2 and various dependency upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
Colcamex Resources Inc committed Dec 28, 2021
1 parent 7bf61b5 commit 8b61cef
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 163 deletions.
151 changes: 28 additions & 123 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
<system>SourceForge Tracker</system>
<url>https://sourceforge.net/tracker/?group_id=66701</url>
</issueManagement>
<!-- <ciManagement>-->
<!-- <system>Jenkins</system>-->
<!-- <url>https://demo.oscarmcmaster.org:11042/</url>-->
<!-- </ciManagement>-->
<ciManagement>
<system>Jenkins</system>
<url>https://jenkins.openosp.ca</url>
</ciManagement>
<inceptionYear>2001</inceptionYear>
<mailingLists>
<mailingList>
Expand All @@ -30,12 +30,12 @@
</license>
</licenses>
<url>http://www.oscarcanada.org</url>
<!-- <scm>-->
<!-- <url>http://oscarmcmaster.git.sourceforge.net/git/gitweb.cgi?p=oscarmcmaster/oscar</url>-->
<!-- <connection>scm:git:git://oscarmcmaster.git.sourceforge.net/gitroot/oscarmcmaster/oscar</connection>-->
<!-- <developerConnection>scm:git:ssh://[email protected].org:29418/oscar</developerConnection>-->
<!-- <tag>master</tag>-->
<!-- </scm>-->
<scm>
<url>https://bitbucket.org/openoscar/oscar/wiki/Home</url>
<connection>scm:git:https://bitbucket.org/openoscar/oscar/branch/master</connection>
<developerConnection>scm:git:ssh:git@bitbucket.org:openoscar/oscar.git</developerConnection>
<tag>master</tag>
</scm>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<log4j2.version>2.17.0</log4j2.version>
Expand All @@ -59,11 +59,6 @@
<url>http://oscarmcmaster.sourceforge.net/m2</url>
</repository>

<!-- <repository>-->
<!-- <id>new_oscar_repo</id>-->
<!-- <url>http://mvn.oscar-emr.com/repository</url>-->
<!-- </repository>-->

<!-- MARC-HI (Everest & SHIC) -->
<!-- <repository>-->
<!-- <id>marc-te-main</id>-->
Expand Down Expand Up @@ -117,19 +112,6 @@
<version>${log4j2.version}</version>
</dependency>

<!-- https://mvnrepository.com/artifact/log4j/apache-log4j-extras -->
<!-- <dependency>-->
<!-- <groupId>log4j</groupId>-->
<!-- <artifactId>apache-log4j-extras</artifactId>-->
<!-- <version>1.2.17</version>-->
<!-- <exclusions>-->
<!-- <exclusion>-->
<!-- <groupId>log4j</groupId>-->
<!-- <artifactId>log4j</artifactId>-->
<!-- </exclusion>-->
<!-- </exclusions>-->
<!-- </dependency>-->

<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
Expand All @@ -143,20 +125,6 @@
<version>${log4j2.version}</version>
</dependency>

<!--Bridge from Apache commons logging to log4j2 -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-jcl</artifactId>
<version>${log4j2.version}</version>
</dependency>

<!-- log4j2 bridge from slf4j -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-to-slf4j</artifactId>
<version>${log4j2.version}</version>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
Expand All @@ -169,12 +137,6 @@
<version>${slf4j.version}</version>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>${slf4j.version}</version>
</dependency>

<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
Expand All @@ -188,7 +150,7 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
<version>2.11.0</version>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
Expand Down Expand Up @@ -298,7 +260,6 @@
<artifactId>spring-mock</artifactId>
<version>2.0.8</version>
</dependency>


<!-- hibernate / sql -->
<dependency>
Expand Down Expand Up @@ -328,7 +289,6 @@
<version>2.2</version>
</dependency>


<!-- pdf / jpedal -->
<dependency>
<groupId>org</groupId>
Expand Down Expand Up @@ -497,7 +457,6 @@
<exclusion>
<groupId>com.lowagie</groupId>
<artifactId>itext</artifactId>
<!-- <version>2.1.7.js8</version>-->
</exclusion>
</exclusions>
</dependency>
Expand Down Expand Up @@ -672,13 +631,7 @@
<artifactId>hsfo2</artifactId>
<version>2.0</version>
</dependency>
<!--
<dependency>
<groupId>wlws</groupId>
<artifactId>wlws</artifactId>
<version>1.0</version>
</dependency>
-->

<!-- apache xml beans -->
<dependency>
<groupId>org.apache.xmlbeans</groupId>
Expand Down Expand Up @@ -814,6 +767,12 @@
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>5.0.0</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
</exclusion>
</exclusions>
</dependency>

<!-- ostermillerutils_1_04_03_for_java_1_4.jar
Expand Down Expand Up @@ -1390,26 +1349,16 @@
<artifactId>maven-site-plugin</artifactId>
<version>3.0</version>
<dependencies>
<!-- dependency>
<groupId>org.apache.maven.doxia</groupId>
<artifactId>doxia-core</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>org.apache.maven.doxia</groupId>
<artifactId>doxia-sink-api</artifactId>
<version>1.3</version>
</dependency -->
<dependency>
<groupId>org.apache.maven.doxia</groupId>
<artifactId>doxia-module-markdown</artifactId>
<version>1.3</version>
</dependency>
</dependencies>
<configuration>
<inputEncoding>UTF-8</inputEncoding>
<outputEncoding>UTF-8</outputEncoding>
</configuration>
<dependency>
<groupId>org.apache.maven.doxia</groupId>
<artifactId>doxia-module-markdown</artifactId>
<version>1.3</version>
</dependency>
</dependencies>
<configuration>
<inputEncoding>UTF-8</inputEncoding>
<outputEncoding>UTF-8</outputEncoding>
</configuration>
</plugin>
<plugin>
<groupId>com.mycila.maven-license-plugin</groupId>
Expand Down Expand Up @@ -1931,50 +1880,6 @@
</build>

<profiles>
<!-- <profile>
<id>jdk6</id>
<activation>
<activeByDefault>false</activeByDefault>
<jdk>1.6</jdk>
</activation>

<dependencies>
<dependency>
<groupId>org.oscarehr</groupId>
<artifactId>datasource-jdk6</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9</version>
<configuration>
<minmemory>128m</minmemory>
<maxmemory>1g</maxmemory>
<tags>
<tag>
<name>todo</name>
<placement>a</placement>
<head>To Do:</head>
</tag>
</tags>
<quiet>true</quiet>
</configuration>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>javadoc</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile> -->
<profile>
<id>jdk7</id>
<activation>
Expand Down
2 changes: 1 addition & 1 deletion set_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export WORKING_ROOT=`pwd`
export CATALINA_BASE=${WORKING_ROOT}/catalina_base

MEM_SETTINGS="-Xms640m -Xmx640m -Xss512k -XX:NewRatio=4 -XX:MaxPermSize=256m "
export JAVA_OPTS="-Djava.awt.headless=true -server -Xincgc -Dorg.apache.el.parser.COERCE_TO_ZERO=false -Dorg.apache.commons.logging.Log=org.apache.cxf.common.logging.Log4jLogger -Dorg.apache.cxf.Logger=org.apache.cxf.common.logging.Log4jLogger -Dlog4j.override.configuration=${WORKING_ROOT}/override_log4j.xml -Doscar_override_properties=${WORKING_ROOT}/oscar.properties "${MEM_SETTINGS}
export JAVA_OPTS="-Djava.awt.headless=true -server -Xincgc -Dorg.apache.el.parser.COERCE_TO_ZERO=false -Dorg.apache.commons.logging.Log=org.apache.cxf.common.logging.Log4j2Logger -Dorg.apache.cxf.Logger=org.apache.cxf.common.logging.Log4j2Logger -Dlog4j.override.configuration=${WORKING_ROOT}/override_log4j2.xml -Doscar_override_properties=${WORKING_ROOT}/oscar.properties "${MEM_SETTINGS}

export MAVEN_OPTS="-Doscar_override_properties=${WORKING_ROOT}/oscar.properties "${MEM_SETTINGS}

27 changes: 18 additions & 9 deletions src/main/java/org/oscarehr/util/ContextStartupListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,26 @@
import org.quartz.impl.StdSchedulerFactory;

import com.quatro.dao.security.SecroleDao;
import oscar.OscarProperties;

public class ContextStartupListener implements javax.servlet.ServletContextListener {
private static final Logger logger = org.oscarehr.util.MiscUtils.getLogger();

private static final OscarProperties oscarProperties = OscarProperties.getInstance();
@Override
public void contextInitialized(javax.servlet.ServletContextEvent sce) {
try {
// ensure cxf uses log4j
System.setProperty("org.apache.cxf.Logger", "org.apache.cxf.common.logging.Log4jLogger");

// ensure cxf uses log4j2
System.setProperty("org.apache.cxf.Logger", "org.apache.cxf.common.logging.Log4j2Logger");

/*
* Map log4j version 1 to version 2
*/
System.setProperty("log4j1.compatibility", "true");

try {
String contextPath=sce.getServletContext().getContextPath();

logger.info("Server processes starting. context=" + contextPath);
logger.info("Starting OSCAR context. context=" + contextPath);

org.oscarehr.util.MiscUtils.addLoggingOverrideConfiguration(contextPath);

Expand All @@ -60,16 +67,19 @@ public void contextInitialized(javax.servlet.ServletContextEvent sce) {
MiscUtils.registerShutdownHook();

createOscarProgramIfNecessary();

CaisiIntegratorUpdateTask.startTask();

if(oscarProperties.getBooleanProperty("INTEGRATOR_ENABLED", "true")){
CaisiIntegratorUpdateTask.startTask();
}

OscarJobUtils.initializeJobExecutionFramework();

WaitListEmailThread.startTaskIfEnabled();

//Run some optimizations
loadCaches();
logger.info("Server processes starting completed. context=" + contextPath);

logger.info("OSCAR server processes started. context=" + contextPath);

//bug 4195 - only runs once so long as it finishes..if you want it to not run, add entry
//try your property table called "HRMFixMissingReportHelper.Run" with value = 1
Expand Down Expand Up @@ -123,7 +133,6 @@ public void contextDestroyed(javax.servlet.ServletContextEvent sce) {

WaitListEmailThread.stopTask();
CaisiIntegratorUpdateTask.stopTask();
// VmStat.stopContinuousLogging();

try {
StdSchedulerFactory.getDefaultScheduler().shutdown();
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/oscar/form/FrmBCAR2020Action.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import net.sf.jasperreports.export.SimpleExporterInput;
import net.sf.jasperreports.export.SimpleOutputStreamExporterOutput;
import org.apache.commons.lang.StringUtils;
import org.apache.logging.log4j.Logger;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
Expand All @@ -45,8 +46,6 @@
import org.oscarehr.util.LoggedInInfo;
import org.oscarehr.util.MiscUtils;
import org.oscarehr.util.SpringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import oscar.form.dao.FormBCAR2020Dao;
import oscar.form.dao.FormBCAR2020DataDao;
import oscar.form.dao.FormBCAR2020TextDao;
Expand Down Expand Up @@ -77,7 +76,7 @@ public class FrmBCAR2020Action extends DispatchAction {
private FormBCAR2020TextDao bcar2020TextDao = SpringUtils.getBean(FormBCAR2020TextDao.class);

private SecurityInfoManager securityInfoManager = SpringUtils.getBean(SecurityInfoManager.class);
private final Logger logger = LoggerFactory.getLogger(FrmBCAR2020Record.class);
private final Logger logger = MiscUtils.getLogger();
private final String RECORD_NAME = "BCAR2020";
private SimpleDateFormat formDateFormat = new SimpleDateFormat( "yyyy/MM/dd");

Expand Down
2 changes: 2 additions & 0 deletions src/main/java/oscar/login/Startup.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ public class Startup implements ServletContextListener {
private oscar.OscarProperties p = oscar.OscarProperties.getInstance();

public void contextInitialized(ServletContextEvent sc) {
logger.info( "Starting OSCAR application " );

try {
logger.debug("contextInit");

Expand Down
30 changes: 3 additions & 27 deletions src/main/resources/log4j.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,9 @@
<param name="ConversionPattern" value="%d %-5p [%c{1}:%L] %m%n" />
</layout>
</appender>

<appender name="INTEGRATOR_FILE" class="org.apache.log4j.DailyRollingFileAppender">
<param name="File" value="${catalina.base}/logs/integrator.log" />
<param name="Append" value="true" />
<param name="DatePattern" value="'.'yyyy-MM" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %-5p [%c{1}:%L] %m%n" />
</layout>
</appender>

<!-- <appender name="VMSTAT_FILE" class="org.apache.log4j.DailyRollingFileAppender">-->
<!-- <param name="File" value="${catalina.base}/logs/vmstat.log" />-->
<!-- -->
<!-- <appender name="INTEGRATOR_FILE" class="org.apache.log4j.DailyRollingFileAppender">-->
<!-- <param name="File" value="${catalina.base}/logs/integrator.log" />-->
<!-- <param name="Append" value="true" />-->
<!-- <param name="DatePattern" value="'.'yyyy-MM" />-->
<!-- <layout class="org.apache.log4j.PatternLayout">-->
Expand Down Expand Up @@ -59,21 +50,6 @@
<priority value="DEBUG" />
</category>
-->

<!-- uncomment for deployments -->

<!--
<category name="org.oscarehr.util.VmStat" additivity="false">
<level value="INFO" />
<appender-ref ref="VMSTAT_FILE" />
</category>
-->

<!-- <category name="org.oscarehr.util.VmStat" >-->
<!-- <priority value="ERROR"/>-->
<!-- </category>-->

<category name="org.apache.cxf.transport.https.HttpsURLConnectionFactory">
<priority value="WARN" />
Expand Down
Loading

0 comments on commit 8b61cef

Please sign in to comment.