Repository: struts Updated Branches: refs/heads/develop d586fd50c -> 7063f5e25
WW-4492 Add support for Log4J2 as a struts and xwork logging backend - Use log4j2 in the struts2 blank maven archetype Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/7063f5e2 Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/7063f5e2 Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/7063f5e2 Branch: refs/heads/develop Commit: 7063f5e25db70aa90b7c98299e111df004a822f4 Parents: d586fd5 Author: Johannes Geppert <joh...@gmail.com> Authored: Fri May 1 13:37:15 2015 +0200 Committer: Johannes Geppert <joh...@gmail.com> Committed: Fri May 1 13:37:15 2015 +0200 ---------------------------------------------------------------------- .../META-INF/maven/archetype-metadata.xml | 8 +--- .../main/resources/archetype-resources/pom.xml | 42 ++++++++++---------- .../src/main/resources/log4j.properties | 29 -------------- .../src/main/resources/log4j2.xml | 16 ++++++++ 4 files changed, 37 insertions(+), 58 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/struts/blob/7063f5e2/archetypes/struts2-archetype-blank/src/main/resources/META-INF/maven/archetype-metadata.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 6485b2c..f1bca37 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 @@ </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> http://git-wip-us.apache.org/repos/asf/struts/blob/7063f5e2/archetypes/struts2-archetype-blank/src/main/resources/archetype-resources/pom.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 7054839..87883a7 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 @@ <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> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-api</artifactId> + <version>\${log4j2.version}</version> </dependency> - <dependency> - <groupId>log4j</groupId> - <artifactId>log4j</artifactId> - <version>1.2.17</version> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-core</artifactId> + <version>\${log4j2.version}</version> </dependency> <dependency> @@ -72,36 +73,33 @@ <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> http://git-wip-us.apache.org/repos/asf/struts/blob/7063f5e2/archetypes/struts2-archetype-blank/src/main/resources/archetype-resources/src/main/resources/log4j.properties ---------------------------------------------------------------------- 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 a29a304..0000000 --- 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 http://git-wip-us.apache.org/repos/asf/struts/blob/7063f5e2/archetypes/struts2-archetype-blank/src/main/resources/archetype-resources/src/main/resources/log4j2.xml ---------------------------------------------------------------------- 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 0000000..6d27d12 --- /dev/null +++ b/archetypes/struts2-archetype-blank/src/main/resources/archetype-resources/src/main/resources/log4j2.xml @@ -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> \ No newline at end of file