Skip to content

Commit

Permalink
WW-4504 - Mark current logging layer as @deprecated and use Log4j2 as…
Browse files Browse the repository at this point in the history
… default one

- Use log4j2 in all provided apps
  • Loading branch information
jogep committed May 25, 2015
1 parent 8e87711 commit 88649ff
Show file tree
Hide file tree
Showing 20 changed files with 133 additions and 175 deletions.
12 changes: 1 addition & 11 deletions apps/blank/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,7 @@
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>${log4j2.version}</version>
</dependency>
<!-- Logging -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
Expand All @@ -78,12 +74,6 @@
<scanTargets>
<scanTarget>src/main/webapp/WEB-INF/web.xml</scanTarget>
</scanTargets>
<systemProperties>
<systemProperty>
<name>xwork.loggerFactory</name>
<value>com.opensymphony.xwork2.util.logging.log4j2.Log4j2LoggerFactory</value>
</systemProperty>
</systemProperties>
</configuration>
</plugin>
</plugins>
Expand Down
4 changes: 2 additions & 2 deletions apps/blank/src/main/resources/log4j2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
</Console>
</Appenders>
<Loggers>
<Logger name="com.opensymphony.xwork2" level="debug"/>
<Logger name="org.apache.struts2" level="debug"/>
<Logger name="com.opensymphony.xwork2" level="info"/>
<Logger name="org.apache.struts2" level="info"/>
<Root level="warn">
<AppenderRef ref="STDOUT"/>
</Root>
Expand Down
8 changes: 8 additions & 0 deletions apps/jboss-blank/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@
<version>2.0</version>
<scope>provided</scope>
</dependency>

<!-- Logging -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>${log4j2.version}</version>
</dependency>

<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>struts2-junit-plugin</artifactId>
Expand Down
15 changes: 15 additions & 0 deletions apps/jboss-blank/src/main/resources/log4j2.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
<Appenders>
<Console name="STDOUT" target="SYSTEM_OUT">
<PatternLayout pattern="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/>
</Console>
</Appenders>
<Loggers>
<Logger name="com.opensymphony.xwork2" level="info"/>
<Logger name="org.apache.struts2" level="info"/>
<Root level="info">
<AppenderRef ref="STDOUT"/>
</Root>
</Loggers>
</Configuration>
31 changes: 13 additions & 18 deletions apps/mailreader/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,18 @@
<version>1.3.5</version>
</dependency>

<!-- Logging -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>${log4j2.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-jcl</artifactId>
<version>${log4j2.version}</version>
</dependency>

</dependencies>

<build>
Expand All @@ -67,30 +79,13 @@
<configuration>
<stopKey>CTRL+C</stopKey>
<stopPort>8999</stopPort>
<systemProperties>
<systemProperty>
<name>log4j.configuration</name>
<value>file:${basedir}/src/main/resources/log4j.properties</value>
</systemProperty>
<systemProperty>
<name>slf4j</name>
<value>false</value>
</systemProperty>
</systemProperties>
<scanIntervalSeconds>10</scanIntervalSeconds>
<scanIntervalSeconds>10</scanIntervalSeconds>
<webAppSourceDirectory>${basedir}/src/main/webapp/</webAppSourceDirectory>
<webAppConfig>
<contextPath>/struts2-mailreader</contextPath>
<descriptor>${basedir}/src/main/webapp/WEB-INF/web.xml</descriptor>
</webAppConfig>
</configuration>
<dependencies>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
Expand Down
36 changes: 0 additions & 36 deletions apps/mailreader/src/main/resources/log4j.properties

This file was deleted.

16 changes: 16 additions & 0 deletions apps/mailreader/src/main/resources/log4j2.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
<Appenders>
<Console name="STDOUT" target="SYSTEM_OUT">
<PatternLayout pattern="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/>
</Console>
</Appenders>
<Loggers>
<Logger name="com.opensymphony.xwork2" level="info"/>
<Logger name="org.apache.struts2" level="info"/>
<Logger name="org.springframework" level="info"/>
<Root level="info">
<AppenderRef ref="STDOUT"/>
</Root>
</Loggers>
</Configuration>
12 changes: 10 additions & 2 deletions apps/portlet/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,17 @@
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
</dependency>

<!-- Logging -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>${log4j2.version}</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>${log4j2.version}</version>
</dependency>

<dependency>
Expand Down
15 changes: 0 additions & 15 deletions apps/portlet/src/main/resources/log4j.xml

This file was deleted.

15 changes: 15 additions & 0 deletions apps/portlet/src/main/resources/log4j2.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
<Appenders>
<Console name="STDOUT" target="SYSTEM_OUT">
<PatternLayout pattern="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/>
</Console>
</Appenders>
<Loggers>
<Logger name="com.opensymphony.xwork2" level="info"/>
<Logger name="org.apache.struts2" level="info"/>
<Root level="warn">
<AppenderRef ref="STDOUT"/>
</Root>
</Loggers>
</Configuration>
1 change: 1 addition & 0 deletions apps/rest-showcase/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
<artifactId>struts2-config-browser-plugin</artifactId>
</dependency>

<!-- Logging -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
Expand Down
44 changes: 18 additions & 26 deletions apps/showcase/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,23 @@
<scope>provided</scope>
</dependency>

<!-- Logging -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>${log4j2.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>${log4j2.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-jcl</artifactId>
<version>${log4j2.version}</version>
</dependency>

<!-- Velocity -->
<dependency>
<groupId>org.apache.velocity</groupId>
Expand All @@ -111,24 +128,6 @@
<groupId>uk.ltd.getahead</groupId>
<artifactId>dwr</artifactId>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</dependency>
<dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-impl</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-api</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
Expand Down Expand Up @@ -189,14 +188,7 @@
<descriptor>${basedir}/src/main/webapp/WEB-INF/web.xml</descriptor>
</webAppConfig>
</configuration>
<dependencies>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
</dependencies>
</plugin>
</plugin>

<plugin>
<artifactId>maven-surefire-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
package org.apache.struts2.showcase.action;

import com.opensymphony.xwork2.ActionSupport;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.struts2.showcase.dao.Dao;
import org.apache.struts2.showcase.model.IdEntity;

Expand All @@ -34,7 +35,7 @@

public abstract class AbstractCRUDAction extends ActionSupport {

private static final Logger log = Logger.getLogger(AbstractCRUDAction.class);
private static final Logger log = LogManager.getLogger(AbstractCRUDAction.class);

private Collection availableItems;
private String[] toDelete;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
package org.apache.struts2.showcase.action;

import com.opensymphony.xwork2.Preparable;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.struts2.showcase.application.TestDataProvider;
import org.apache.struts2.showcase.dao.Dao;
import org.apache.struts2.showcase.dao.EmployeeDao;
Expand All @@ -42,7 +43,7 @@ public class EmployeeAction extends AbstractCRUDAction implements Preparable {

private static final long serialVersionUID = 7047317819789938957L;

private static final Logger log = Logger.getLogger(EmployeeAction.class);
private static final Logger log = LogManager.getLogger(EmployeeAction.class);

@Autowired
private EmployeeDao employeeDao;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
package org.apache.struts2.showcase.action;

import com.opensymphony.xwork2.Preparable;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.struts2.showcase.dao.Dao;
import org.apache.struts2.showcase.dao.SkillDao;
import org.apache.struts2.showcase.model.Skill;
Expand All @@ -33,7 +34,7 @@

public class SkillAction extends AbstractCRUDAction implements Preparable {

private static final Logger log = Logger.getLogger(SkillAction.class);
private static final Logger log = LogManager.getLogger(SkillAction.class);

@Autowired
private SkillDao skillDao;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
*/
package org.apache.struts2.showcase.application;

import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.struts2.showcase.dao.EmployeeDao;
import org.apache.struts2.showcase.dao.SkillDao;
import org.apache.struts2.showcase.exception.StorageException;
Expand All @@ -41,7 +42,7 @@
public class TestDataProvider implements Serializable, InitializingBean {

private static final long serialVersionUID = 1L;
private static final Logger log = Logger.getLogger(TestDataProvider.class);
private static final Logger log = LogManager.getLogger(TestDataProvider.class);

public static final String[] POSITIONS = {
"Developer",
Expand Down
Loading

0 comments on commit 88649ff

Please sign in to comment.