mirror of
https://github.com/apache/struts.git
synced 2026-08-06 23:27:07 +00:00
WW-4492 Add support for Log4J2 as a struts and xwork logging backend
- Use log4j2 in the struts2 blank maven archetype
This commit is contained in:
+1
-7
@@ -22,13 +22,6 @@
|
||||
</includes>
|
||||
</fileSet>
|
||||
|
||||
<fileSet filtered="false" packaged="false">
|
||||
<directory>src/main/resources</directory>
|
||||
<includes>
|
||||
<include>log4j.properties</include>
|
||||
</includes>
|
||||
</fileSet>
|
||||
|
||||
<fileSet filtered="false" packaged="true">
|
||||
<directory>src/main/resources</directory>
|
||||
<includes>
|
||||
@@ -40,6 +33,7 @@
|
||||
<directory>src/main/resources</directory>
|
||||
<includes>
|
||||
<include>**/struts.xml</include>
|
||||
<include>**/log4j2.xml</include>
|
||||
<include>**/example.xml</include>
|
||||
</includes>
|
||||
</fileSet>
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
<properties>
|
||||
<struts2.version>${project.version}</struts2.version>
|
||||
<log4j2.version>${log4j2.version}</log4j2.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
@@ -34,16 +35,16 @@
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
<version>1.1.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.17</version>
|
||||
<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>
|
||||
@@ -71,37 +72,34 @@
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.3</version>
|
||||
<configuration>
|
||||
<encoding>UTF-8</encoding>
|
||||
<source>1.5</source>
|
||||
<target>1.5</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.mortbay.jetty</groupId>
|
||||
<artifactId>jetty-maven-plugin</artifactId>
|
||||
<version>8.1.7.v20120910</version>
|
||||
<version>8.1.16.v20140903</version>
|
||||
<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>
|
||||
<name>xwork.loggerFactory</name>
|
||||
<value>com.opensymphony.xwork2.util.logging.log4j2.Log4j2LoggerFactory</value>
|
||||
</systemProperty>
|
||||
</systemProperties>
|
||||
<scanIntervalSeconds>10</scanIntervalSeconds>
|
||||
<webAppSourceDirectory>\${basedir}/src/main/webapp/</webAppSourceDirectory>
|
||||
<webAppConfig>
|
||||
<contextPath>/\${artifactId}</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>
|
||||
|
||||
-29
@@ -1,29 +0,0 @@
|
||||
#
|
||||
# Log4J Settings for log4j 1.2.x (via jakarta-commons-logging)
|
||||
#
|
||||
# The five logging levels used by Log are (in order):
|
||||
#
|
||||
# 1. DEBUG (the least serious)
|
||||
# 2. INFO
|
||||
# 3. WARN
|
||||
# 4. ERROR
|
||||
# 5. FATAL (the most serious)
|
||||
|
||||
|
||||
# Set root logger level to WARN and append to stdout
|
||||
log4j.rootLogger=WARN, stdout
|
||||
|
||||
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
|
||||
|
||||
# Pattern to output the caller's file name and line number.
|
||||
log4j.appender.stdout.layout.ConversionPattern=%d %5p (%c:%L) - %m%n
|
||||
|
||||
# Print only messages of level ERROR or above in the package noModule.
|
||||
log4j.logger.noModule=ERROR
|
||||
|
||||
# OpenSymphony Stuff
|
||||
log4j.logger.com.opensymphony=INFO
|
||||
|
||||
# Struts2 Stuff
|
||||
log4j.logger.org.apache.struts2=INFO
|
||||
+16
@@ -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="\${groupId}" level="debug"/>
|
||||
<Root level="warn">
|
||||
<AppenderRef ref="STDOUT"/>
|
||||
</Root>
|
||||
</Loggers>
|
||||
</Configuration>
|
||||
Reference in New Issue
Block a user