changed logger implementation to log4j2

Tue, 26 Dec 2017 19:18:32 +0100

author
Mike Becker <universe@uap-core.de>
date
Tue, 26 Dec 2017 19:18:32 +0100
changeset 14
2b270c714678
parent 13
f4608ad6c947
child 15
bb594abac796

changed logger implementation to log4j2

nbproject/build-impl.xml file | annotate | diff | comparison | revisions
nbproject/genfiles.properties file | annotate | diff | comparison | revisions
nbproject/project.properties file | annotate | diff | comparison | revisions
nbproject/project.xml file | annotate | diff | comparison | revisions
src/java/de/uapcore/lightpit/AbstractLightPITServlet.java file | annotate | diff | comparison | revisions
src/java/de/uapcore/lightpit/modules/LanguageModule.java file | annotate | diff | comparison | revisions
src/java/log4j2.properties file | annotate | diff | comparison | revisions
src/java/logging.properties file | annotate | diff | comparison | revisions
--- a/nbproject/build-impl.xml	Tue Dec 26 17:36:47 2017 +0100
+++ b/nbproject/build-impl.xml	Tue Dec 26 19:18:32 2017 +0100
@@ -998,13 +998,15 @@
     <target depends="init,compile,compile-jsps,-pre-dist,-do-dist-with-manifest,-do-dist-without-manifest" name="do-dist"/>
     <target depends="init" if="dist.ear.dir" name="library-inclusion-in-manifest">
         <copyfiles files="${libs.jstl.classpath}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
-        <copyfiles files="${libs.SLF4J-JDK.classpath}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
+        <copyfiles files="${libs.SLF4J-LOG4J2.classpath}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
+        <copyfiles files="${libs.LOG4J2-WEB.classpath}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
         <mkdir dir="${build.web.dir}/META-INF"/>
         <manifest file="${build.web.dir}/META-INF/MANIFEST.MF" mode="update"/>
     </target>
     <target depends="init" name="library-inclusion-in-archive" unless="dist.ear.dir">
         <copyfiles files="${libs.jstl.classpath}" todir="${build.web.dir}/WEB-INF/lib"/>
-        <copyfiles files="${libs.SLF4J-JDK.classpath}" todir="${build.web.dir}/WEB-INF/lib"/>
+        <copyfiles files="${libs.SLF4J-LOG4J2.classpath}" todir="${build.web.dir}/WEB-INF/lib"/>
+        <copyfiles files="${libs.LOG4J2-WEB.classpath}" todir="${build.web.dir}/WEB-INF/lib"/>
     </target>
     <target depends="init" if="dist.ear.dir" name="-clean-webinf-lib">
         <delete dir="${build.web.dir}/WEB-INF/lib"/>
--- a/nbproject/genfiles.properties	Tue Dec 26 17:36:47 2017 +0100
+++ b/nbproject/genfiles.properties	Tue Dec 26 19:18:32 2017 +0100
@@ -1,8 +1,8 @@
-build.xml.data.CRC32=343ad249
+build.xml.data.CRC32=40807f5e
 build.xml.script.CRC32=1f023e98
 build.xml.stylesheet.CRC32=651128d4@1.77.1.1
 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
 # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
-nbproject/build-impl.xml.data.CRC32=343ad249
-nbproject/build-impl.xml.script.CRC32=36eb4694
+nbproject/build-impl.xml.data.CRC32=40807f5e
+nbproject/build-impl.xml.script.CRC32=0c71c5d8
 nbproject/build-impl.xml.stylesheet.CRC32=99ea4b56@1.77.1.1
--- a/nbproject/project.properties	Tue Dec 26 17:36:47 2017 +0100
+++ b/nbproject/project.properties	Tue Dec 26 19:18:32 2017 +0100
@@ -38,7 +38,8 @@
 jar.compress=false
 javac.classpath=\
     ${libs.jstl.classpath}:\
-    ${libs.SLF4J-JDK.classpath}
+    ${libs.SLF4J-LOG4J2.classpath}:\
+    ${libs.LOG4J2-WEB.classpath}
 # Space-separated list of extra javac options
 javac.compilerargs=
 javac.debug=true
--- a/nbproject/project.xml	Tue Dec 26 17:36:47 2017 +0100
+++ b/nbproject/project.xml	Tue Dec 26 19:18:32 2017 +0100
@@ -11,7 +11,11 @@
                     <path-in-war>WEB-INF/lib</path-in-war>
                 </library>
                 <library dirs="200">
-                    <file>${libs.SLF4J-JDK.classpath}</file>
+                    <file>${libs.SLF4J-LOG4J2.classpath}</file>
+                    <path-in-war>WEB-INF/lib</path-in-war>
+                </library>
+                <library dirs="200">
+                    <file>${libs.LOG4J2-WEB.classpath}</file>
                     <path-in-war>WEB-INF/lib</path-in-war>
                 </library>
             </web-module-libraries>
--- a/src/java/de/uapcore/lightpit/AbstractLightPITServlet.java	Tue Dec 26 17:36:47 2017 +0100
+++ b/src/java/de/uapcore/lightpit/AbstractLightPITServlet.java	Tue Dec 26 19:18:32 2017 +0100
@@ -87,7 +87,7 @@
     private ResponseType invokeMapping(Method method, HttpServletRequest req, HttpServletResponse resp)
             throws IOException, ServletException {
         try {
-            LOG.debug("invoke {}", method.getName());
+            LOG.trace("invoke {}#{}", method.getDeclaringClass().getName(), method.getName());
             return (ResponseType) method.invoke(this, req, resp);
         } catch (ReflectiveOperationException | ClassCastException ex) {
             LOG.error(String.format("invocation of method %s failed", method.getName()), ex);
@@ -242,6 +242,8 @@
             Locale sessionLocale = reqLocale.filter((rl) -> availableLanguages.map((al) -> al.contains(rl.getLanguage())).orElse(false)).orElse(Locale.ENGLISH);
             session.setAttribute(Constants.SESSION_ATTR_LANGUAGE, sessionLocale);
             LOG.debug("Settng language for new session {}: {}", session.getId(), sessionLocale.getDisplayLanguage());
+        } else {
+            LOG.trace("Continuing session {} with language {}", session.getId(), session.getAttribute(Constants.SESSION_ATTR_LANGUAGE));
         }
         
         req.setAttribute(Constants.REQ_ATTR_PATH, Functions.fullPath(req));
--- a/src/java/de/uapcore/lightpit/modules/LanguageModule.java	Tue Dec 26 17:36:47 2017 +0100
+++ b/src/java/de/uapcore/lightpit/modules/LanguageModule.java	Tue Dec 26 19:18:32 2017 +0100
@@ -30,7 +30,6 @@
 
 import de.uapcore.lightpit.LightPITModule;
 import de.uapcore.lightpit.AbstractLightPITServlet;
-import de.uapcore.lightpit.Constants;
 import de.uapcore.lightpit.Functions;
 import de.uapcore.lightpit.HttpMethod;
 import javax.servlet.annotation.WebServlet;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java/log4j2.properties	Tue Dec 26 19:18:32 2017 +0100
@@ -0,0 +1,36 @@
+# Copyright 2017 Mike Becker. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+
+
+status = warn
+dest = err
+name = PropertiesConfig
+ 
+appender.console.type = Console
+appender.console.name = STDOUT
+appender.console.layout.type = PatternLayout
+appender.console.layout.pattern = %d{ISO8601} %p - %M: %m %n
+ 
+rootLogger.appenderRef.stdout.ref = STDOUT
+
+rootLogger.level = debug
--- a/src/java/logging.properties	Tue Dec 26 17:36:47 2017 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-# Copyright 2017 Mike Becker. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
-
-
-handlers= java.util.logging.ConsoleHandler
-
-.level = DEBUG

mercurial