From 7063f5e25db70aa90b7c98299e111df004a822f4 Mon Sep 17 00:00:00 2001 From: Johannes Geppert Date: Fri, 1 May 2015 13:37:15 +0200 Subject: [PATCH] WW-4492 Add support for Log4J2 as a struts and xwork logging backend - Use log4j2 in the struts2 blank maven archetype --- .../META-INF/maven/archetype-metadata.xml | 8 +--- .../resources/archetype-resources/pom.xml | 44 +++++++++---------- .../src/main/resources/log4j.properties | 29 ------------ .../src/main/resources/log4j2.xml | 16 +++++++ 4 files changed, 38 insertions(+), 59 deletions(-) delete mode 100644 archetypes/struts2-archetype-blank/src/main/resources/archetype-resources/src/main/resources/log4j.properties create mode 100644 archetypes/struts2-archetype-blank/src/main/resources/archetype-resources/src/main/resources/log4j2.xml diff --git a/archetypes/struts2-archetype-blank/src/main/resources/META-INF/maven/archetype-metadata.xml b/archetypes/struts2-archetype-blank/src/main/resources/META-INF/maven/archetype-metadata.xml index 6485b2ce0..f1bca3741 100644 --- a/archetypes/struts2-archetype-blank/src/main/resources/META-INF/maven/archetype-metadata.xml +++ b/archetypes/struts2-archetype-blank/src/main/resources/META-INF/maven/archetype-metadata.xml @@ -22,13 +22,6 @@ - - src/main/resources - - log4j.properties - - - src/main/resources @@ -40,6 +33,7 @@ src/main/resources **/struts.xml + **/log4j2.xml **/example.xml diff --git a/archetypes/struts2-archetype-blank/src/main/resources/archetype-resources/pom.xml b/archetypes/struts2-archetype-blank/src/main/resources/archetype-resources/pom.xml index 70548396e..87883a7fa 100644 --- a/archetypes/struts2-archetype-blank/src/main/resources/archetype-resources/pom.xml +++ b/archetypes/struts2-archetype-blank/src/main/resources/archetype-resources/pom.xml @@ -10,6 +10,7 @@ ${project.version} + ${log4j2.version} UTF-8 @@ -34,16 +35,16 @@ test - - commons-logging - commons-logging - 1.1.3 - - log4j - log4j - 1.2.17 + org.apache.logging.log4j + log4j-api + \${log4j2.version} + + + org.apache.logging.log4j + log4j-core + \${log4j2.version} @@ -71,37 +72,34 @@ + + maven-compiler-plugin + 3.3 + + UTF-8 + 1.5 + 1.5 + + org.mortbay.jetty jetty-maven-plugin - 8.1.7.v20120910 + 8.1.16.v20140903 CTRL+C 8999 - log4j.configuration - file:\${basedir}/src/main/resources/log4j.properties - - - slf4j - false + xwork.loggerFactory + com.opensymphony.xwork2.util.logging.log4j2.Log4j2LoggerFactory 10 \${basedir}/src/main/webapp/ - /\${artifactId} \${basedir}/src/main/webapp/WEB-INF/web.xml - - - log4j - log4j - 1.2.17 - - diff --git a/archetypes/struts2-archetype-blank/src/main/resources/archetype-resources/src/main/resources/log4j.properties b/archetypes/struts2-archetype-blank/src/main/resources/archetype-resources/src/main/resources/log4j.properties deleted file mode 100644 index a29a304b3..000000000 --- a/archetypes/struts2-archetype-blank/src/main/resources/archetype-resources/src/main/resources/log4j.properties +++ /dev/null @@ -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 diff --git a/archetypes/struts2-archetype-blank/src/main/resources/archetype-resources/src/main/resources/log4j2.xml b/archetypes/struts2-archetype-blank/src/main/resources/archetype-resources/src/main/resources/log4j2.xml new file mode 100644 index 000000000..6d27d1215 --- /dev/null +++ b/archetypes/struts2-archetype-blank/src/main/resources/archetype-resources/src/main/resources/log4j2.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file