struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jo...@apache.org
Subject [02/50] [abbrv] struts-examples git commit: WW-4492 Add support for Log4J2 as a struts and xwork logging backend
Date Thu, 11 Jun 2015 19:16:39 GMT
 WW-4492 Add support for Log4J2 as a struts and xwork logging backend

 - Use new log4j2 in blank and rest showcase app
 - Migrate to newer jetty plugin version


Project: http://git-wip-us.apache.org/repos/asf/struts-examples/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts-examples/commit/05216e09
Tree: http://git-wip-us.apache.org/repos/asf/struts-examples/tree/05216e09
Diff: http://git-wip-us.apache.org/repos/asf/struts-examples/diff/05216e09

Branch: refs/heads/master
Commit: 05216e091e49567f5181334db5f741d4c354ee29
Parents: a40ac26
Author: Johannes Geppert <johgep@gmail.com>
Authored: Sat Apr 18 21:15:48 2015 +0200
Committer: Johannes Geppert <johgep@gmail.com>
Committed: Sat Apr 18 21:15:48 2015 +0200

----------------------------------------------------------------------
 pom.xml                             | 18 +++++++++++++++---
 src/main/resources/log4j.properties | 26 --------------------------
 src/main/resources/log4j2.xml       | 15 +++++++++++++++
 3 files changed, 30 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts-examples/blob/05216e09/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 979f077..c105dd8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -48,8 +48,14 @@
         </dependency>
 
         <dependency>
-            <groupId>log4j</groupId>
-            <artifactId>log4j</artifactId>
+            <groupId>org.apache.logging.log4j</groupId>
+            <artifactId>log4j-api</artifactId>
+            <version>2.2</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.logging.log4j</groupId>
+            <artifactId>log4j-core</artifactId>
+            <version>2.2</version>
         </dependency>
 
         <dependency>
@@ -64,7 +70,7 @@
             <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>
@@ -72,6 +78,12 @@
                     <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>

http://git-wip-us.apache.org/repos/asf/struts-examples/blob/05216e09/src/main/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/src/main/resources/log4j.properties b/src/main/resources/log4j.properties
deleted file mode 100644
index 3c5af7c..0000000
--- a/src/main/resources/log4j.properties
+++ /dev/null
@@ -1,26 +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=INFO, stdout
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.Target=System.out
-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=FATAL
-
-log4j.logger.com.opensymphony.xwork2=DEBUG
-log4j.logger.org.apache.struts2=DEBUG

http://git-wip-us.apache.org/repos/asf/struts-examples/blob/05216e09/src/main/resources/log4j2.xml
----------------------------------------------------------------------
diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml
new file mode 100644
index 0000000..aee8b3b
--- /dev/null
+++ b/src/main/resources/log4j2.xml
@@ -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="debug"/>
+        <Logger name="org.apache.struts2" level="debug"/>
+        <Root level="warn">
+            <AppenderRef ref="STDOUT"/>
+        </Root>
+    </Loggers>
+</Configuration>
\ No newline at end of file


Mime
View raw message