WW-4492 Add support for Log4J2 as a struts and xwork logging backend - Use log4j2 in the angularjs maven archetype
Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/e990fbb7 Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/e990fbb7 Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/e990fbb7 Branch: refs/heads/develop Commit: e990fbb751af3ed83123ca71bd90b76eec24cf5c Parents: 7afa4ae Author: Johannes Geppert <joh...@gmail.com> Authored: Fri May 1 12:46:59 2015 +0200 Committer: Johannes Geppert <joh...@gmail.com> Committed: Fri May 1 12:46:59 2015 +0200 ---------------------------------------------------------------------- .../META-INF/maven/archetype-metadata.xml | 2 +- .../main/resources/archetype-resources/pom.xml | 38 +++++++++----------- .../src/main/resources/log4j.properties | 29 --------------- .../src/main/resources/log4j2.xml | 16 +++++++++ 4 files changed, 34 insertions(+), 51 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/struts/blob/e990fbb7/archetypes/struts2-archetype-angularjs/src/main/resources/META-INF/maven/archetype-metadata.xml ---------------------------------------------------------------------- diff --git a/archetypes/struts2-archetype-angularjs/src/main/resources/META-INF/maven/archetype-metadata.xml b/archetypes/struts2-archetype-angularjs/src/main/resources/META-INF/maven/archetype-metadata.xml index b826600..5253d83 100644 --- a/archetypes/struts2-archetype-angularjs/src/main/resources/META-INF/maven/archetype-metadata.xml +++ b/archetypes/struts2-archetype-angularjs/src/main/resources/META-INF/maven/archetype-metadata.xml @@ -30,7 +30,7 @@ </includes> </fileSet> - <fileSet filtered="false" packaged="false"> + <fileSet filtered="true" packaged="false"> <directory>src/main/resources</directory> <includes> <include>**/*.xml</include> http://git-wip-us.apache.org/repos/asf/struts/blob/e990fbb7/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/pom.xml ---------------------------------------------------------------------- diff --git a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/pom.xml b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/pom.xml index 06422ce..3872a06 100644 --- a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/pom.xml +++ b/archetypes/struts2-archetype-angularjs/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> @@ -47,17 +48,17 @@ </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> <groupId>junit</groupId> <artifactId>junit</artifactId> @@ -84,7 +85,9 @@ <build> <plugins> <plugin> + <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> + <version>3.3</version> <configuration> <encoding>UTF-8</encoding> <source>1.5</source> @@ -94,29 +97,22 @@ <plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>jetty-maven-plugin</artifactId> - <version>8.1.12.v20130726</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> + <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/e990fbb7/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/resources/log4j.properties ---------------------------------------------------------------------- diff --git a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/resources/log4j.properties b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/resources/log4j.properties deleted file mode 100644 index a29a304..0000000 --- a/archetypes/struts2-archetype-angularjs/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/e990fbb7/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/resources/log4j2.xml ---------------------------------------------------------------------- diff --git a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/resources/log4j2.xml b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/resources/log4j2.xml new file mode 100644 index 0000000..6d27d12 --- /dev/null +++ b/archetypes/struts2-archetype-angularjs/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