changeset 437:5011173fd340

Updated logging infrastructure. Using log4j 1.2.17 since log4j2 does not with arquillian.
author Raimund Renkert <raimund.renkert@intevation.de>
date Fri, 06 Feb 2015 15:58:28 +0100
parents 8157dd28aba7
children f0ad10e0e1b1
files pom.xml src/main/java/de/intevation/lada/util/factory/LoggerFactory.java src/main/resources/META-INF/persistence.xml src/main/webapp/WEB-INF/classes/log4j.properties src/main/webapp/WEB-INF/classes/log4j2.json src/test/java/de/intevation/lada/LadaTest.java src/test/resources/META-INF/test-persistence.xml src/test/resources/log4j.properties
diffstat 8 files changed, 33 insertions(+), 73 deletions(-) [+]
line wrap: on
line diff
--- a/pom.xml	Fri Feb 06 13:35:47 2015 +0100
+++ b/pom.xml	Fri Feb 06 15:58:28 2015 +0100
@@ -46,11 +46,11 @@
             <artifactId>cdi-api</artifactId>
             <scope>provided</scope>
         </dependency>
-        <!-- dependency>
+        <dependency>
             <groupId>javax.ws.rs</groupId>
-            <artifactId>jsr311-api</artifactId>
-            <version>1.1.1</version>
-        </dependency-->
+            <artifactId>javax.ws.rs-api</artifactId>
+            <version>2.0.1</version>
+        </dependency>
         <dependency>
             <groupId>org.jboss.spec.javax.ejb</groupId>
             <artifactId>jboss-ejb-api_3.2_spec</artifactId>
@@ -100,24 +100,9 @@
 
         <!-- Logging -->
         <dependency>
-            <groupId>org.apache.logging.log4j</groupId>
-            <artifactId>log4j-core</artifactId>
-            <version>2.1</version>
-        </dependency>
-        <dependency>
-            <groupId>com.fasterxml.jackson.core</groupId>
-            <artifactId>jackson-core</artifactId>
-            <version>2.4.2</version>
-        </dependency>
-        <dependency>
-            <groupId>com.fasterxml.jackson.core</groupId>
-            <artifactId>jackson-databind</artifactId>
-            <version>2.4.2</version>
-        </dependency> 
-        <dependency>
-            <groupId>com.fasterxml.jackson.core</groupId>
-            <artifactId>jackson-annotations</artifactId>
-            <version>2.4.2</version>
+            <groupId>log4j</groupId>
+            <artifactId>log4j</artifactId>
+            <version>1.2.17</version>
         </dependency>
 
         <!-- Arquillian/Testing -->
@@ -185,7 +170,7 @@
             <dependencies>
                 <dependency>
                     <groupId>org.wildfly</groupId>
-                    <artifactId>wildfly-arquillian-container-remote</artifactId>
+                    <artifactId>wildfly-arquillian-container-managed</artifactId>
                     <version>8.2.0.Final</version>
                     <scope>test</scope>
                 </dependency>
--- a/src/main/java/de/intevation/lada/util/factory/LoggerFactory.java	Fri Feb 06 13:35:47 2015 +0100
+++ b/src/main/java/de/intevation/lada/util/factory/LoggerFactory.java	Fri Feb 06 15:58:28 2015 +0100
@@ -11,8 +11,7 @@
 import javax.enterprise.inject.Produces;
 import javax.enterprise.inject.spi.InjectionPoint;
 
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
+import org.apache.log4j.Logger;
 
 
 @ApplicationScoped
@@ -20,7 +19,7 @@
 
     @Produces
     Logger createLogger(InjectionPoint injectionPoint) {
-        return LogManager.getLogger(
+        return Logger.getLogger(
             injectionPoint.getMember().getDeclaringClass().getName());
     }
 }
--- a/src/main/resources/META-INF/persistence.xml	Fri Feb 06 13:35:47 2015 +0100
+++ b/src/main/resources/META-INF/persistence.xml	Fri Feb 06 15:58:28 2015 +0100
@@ -9,7 +9,7 @@
         <properties>
             <property name="jboss.entity.manager.jndi.name" value="java:app/entitymanager/bund"/>
             <!-- Properties for Hibernate -->
-            <property name="hibernate.show_sql" value="true" />
+            <property name="hibernate.show_sql" value="false" />
             <property name="hibernate.dialect" value="org.hibernate.spatial.dialect.postgis.PostgisDialect"/>
             <property name="hibernate.hbm2ddl.auto" value="none"/>
             <property name="hibernate.transaction.jta.platform" value="org.hibernate.service.jta.platform.internal.JBossAppServerJtaPlatform" /> 
@@ -21,7 +21,7 @@
        	<exclude-unlisted-classes>false</exclude-unlisted-classes>
     	<properties>
             <property name="jboss.entity.manager.jndi.name" value="java:app/entitymanager/land"/>
-            <property name="hibernate.show_sql" value="true" />
+            <property name="hibernate.show_sql" value="false" />
             <property name="hibernate.dialect" value="org.hibernate.spatial.dialect.postgis.PostgisDialect"/>
             <property name="hibernate.hbm2ddl.auto" value="none"/>
        </properties>
@@ -31,7 +31,7 @@
         <jta-data-source>java:/jboss/lada-stamm</jta-data-source>
         <properties>
             <property name="jboss.entity.manager.jndi.name" value="java:app/entitymanager/stamm"/>
-            <property name="hibernate.show_sql" value="true" />
+            <property name="hibernate.show_sql" value="false" />
             <property name="hibernate.dialect" value="org.hibernate.spatial.dialect.postgis.PostgisDialect"/>
             <property name="hibernate.hbm2ddl.auto" value="none"/>
         </properties>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/webapp/WEB-INF/classes/log4j.properties	Fri Feb 06 15:58:28 2015 +0100
@@ -0,0 +1,8 @@
+log4j.rootLogger=DEBUG, lada
+log4j.logger.org.hibernate=ERROR
+log4j.appender.lada=org.apache.log4j.RollingFileAppender
+log4j.appender.lada.File=../log/lada-server.log
+log4j.appender.lada.MaxFileSize=1MB
+log4j.appender.lada.MaxBackupIndex=5
+log4j.appender.lada.layout=org.apache.log4j.PatternLayout
+log4j.appender.lada.layout.ConversionPattern=%d %p %l: %m%n
--- a/src/main/webapp/WEB-INF/classes/log4j2.json	Fri Feb 06 13:35:47 2015 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-{
-    "configuration": {
-        "status": "error",
-        "name": "LadaLogger",
-        "properties": {
-            "property": [{
-                "name": "filename",
-                "value": "lada-test.log"
-            }, {
-                "name": "directory",
-                "value": "../log"
-            }]
-        },
-        "appenders": {
-            "RollingFile": {
-                "name": "File",
-                "fileName": "${directory}/${filename}",
-                "filePattern": "${directory}/${date:yyyy-MM}/test-%d{MM-dd-yyyy}-%i.log",
-                "patternLayout": {
-                    "pattern": "%d %p %logger: %m%n"
-                },
-                "policies": {
-                    "SizeBasedTriggeringPolicy": {
-                        "size": "2 MB"
-                    }
-                },
-                "DefaultRolloverStrategy": {
-                    "max": "10"
-                }
-            }
-        },
-        "loggers": {
-            "root": {
-                "level": "debug",
-                "appender-ref": {
-                    "ref": "File"
-                }
-            }
-        }
-    }
-}
--- a/src/test/java/de/intevation/lada/LadaTest.java	Fri Feb 06 13:35:47 2015 +0100
+++ b/src/test/java/de/intevation/lada/LadaTest.java	Fri Feb 06 15:58:28 2015 +0100
@@ -29,6 +29,7 @@
         return ShrinkWrap.create(WebArchive.class, "lada-basis-test.war")
             .addPackages(true, Package.getPackage("de.intevation.lada"))
             .addClass(QueryServiceTest.class)
+            .addAsResource("log4j.properties", "log4j.properties")
             .addAsResource("queryconf.json", "queryconf.json")
             .addAsResource("META-INF/test-persistence.xml",
                 "META-INF/persistence.xml");
--- a/src/test/resources/META-INF/test-persistence.xml	Fri Feb 06 13:35:47 2015 +0100
+++ b/src/test/resources/META-INF/test-persistence.xml	Fri Feb 06 15:58:28 2015 +0100
@@ -9,7 +9,7 @@
         <properties>
             <property name="jboss.entity.manager.jndi.name" value="java:app/entitymanager/bund"/>
             <!-- Properties for Hibernate -->
-            <property name="hibernate.show_sql" value="true" />
+            <property name="hibernate.show_sql" value="false" />
             <property name="hibernate.dialect" value="org.hibernate.spatial.dialect.postgis.PostgisDialect"/>
             <property name="hibernate.hbm2ddl.auto" value="none"/>
             <property name="hibernate.transaction.jta.platform" value="org.hibernate.service.jta.platform.internal.JBossAppServerJtaPlatform" /> 
@@ -21,7 +21,7 @@
        	<exclude-unlisted-classes>false</exclude-unlisted-classes>
     	<properties>
             <property name="jboss.entity.manager.jndi.name" value="java:app/entitymanager/land"/>
-            <property name="hibernate.show_sql" value="true" />
+            <property name="hibernate.show_sql" value="false" />
             <property name="hibernate.dialect" value="org.hibernate.spatial.dialect.postgis.PostgisDialect"/>
             <property name="hibernate.hbm2ddl.auto" value="none"/>
        </properties>
@@ -31,7 +31,7 @@
         <jta-data-source>java:/jboss/lada-stamm</jta-data-source>
         <properties>
             <property name="jboss.entity.manager.jndi.name" value="java:app/entitymanager/stamm"/>
-            <property name="hibernate.show_sql" value="true" />
+            <property name="hibernate.show_sql" value="false" />
             <property name="hibernate.dialect" value="org.hibernate.spatial.dialect.postgis.PostgisDialect"/>
             <property name="hibernate.hbm2ddl.auto" value="none"/>
         </properties>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/test/resources/log4j.properties	Fri Feb 06 15:58:28 2015 +0100
@@ -0,0 +1,8 @@
+log4j.rootLogger=DEBUG, lada
+log4j.logger.org.hibernate=ERROR
+log4j.appender.lada=org.apache.log4j.RollingFileAppender
+log4j.appender.lada.File=../log/lada-server.log
+log4j.appender.lada.MaxFileSize=1MB
+log4j.appender.lada.MaxBackupIndex=5
+log4j.appender.lada.layout=org.apache.log4j.PatternLayout
+log4j.appender.lada.layout.ConversionPattern=%d %p %l: %m%n
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)