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
     1.1 --- a/nbproject/build-impl.xml	Tue Dec 26 17:36:47 2017 +0100
     1.2 +++ b/nbproject/build-impl.xml	Tue Dec 26 19:18:32 2017 +0100
     1.3 @@ -998,13 +998,15 @@
     1.4      <target depends="init,compile,compile-jsps,-pre-dist,-do-dist-with-manifest,-do-dist-without-manifest" name="do-dist"/>
     1.5      <target depends="init" if="dist.ear.dir" name="library-inclusion-in-manifest">
     1.6          <copyfiles files="${libs.jstl.classpath}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
     1.7 -        <copyfiles files="${libs.SLF4J-JDK.classpath}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
     1.8 +        <copyfiles files="${libs.SLF4J-LOG4J2.classpath}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
     1.9 +        <copyfiles files="${libs.LOG4J2-WEB.classpath}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
    1.10          <mkdir dir="${build.web.dir}/META-INF"/>
    1.11          <manifest file="${build.web.dir}/META-INF/MANIFEST.MF" mode="update"/>
    1.12      </target>
    1.13      <target depends="init" name="library-inclusion-in-archive" unless="dist.ear.dir">
    1.14          <copyfiles files="${libs.jstl.classpath}" todir="${build.web.dir}/WEB-INF/lib"/>
    1.15 -        <copyfiles files="${libs.SLF4J-JDK.classpath}" todir="${build.web.dir}/WEB-INF/lib"/>
    1.16 +        <copyfiles files="${libs.SLF4J-LOG4J2.classpath}" todir="${build.web.dir}/WEB-INF/lib"/>
    1.17 +        <copyfiles files="${libs.LOG4J2-WEB.classpath}" todir="${build.web.dir}/WEB-INF/lib"/>
    1.18      </target>
    1.19      <target depends="init" if="dist.ear.dir" name="-clean-webinf-lib">
    1.20          <delete dir="${build.web.dir}/WEB-INF/lib"/>
     2.1 --- a/nbproject/genfiles.properties	Tue Dec 26 17:36:47 2017 +0100
     2.2 +++ b/nbproject/genfiles.properties	Tue Dec 26 19:18:32 2017 +0100
     2.3 @@ -1,8 +1,8 @@
     2.4 -build.xml.data.CRC32=343ad249
     2.5 +build.xml.data.CRC32=40807f5e
     2.6  build.xml.script.CRC32=1f023e98
     2.7  build.xml.stylesheet.CRC32=651128d4@1.77.1.1
     2.8  # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
     2.9  # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
    2.10 -nbproject/build-impl.xml.data.CRC32=343ad249
    2.11 -nbproject/build-impl.xml.script.CRC32=36eb4694
    2.12 +nbproject/build-impl.xml.data.CRC32=40807f5e
    2.13 +nbproject/build-impl.xml.script.CRC32=0c71c5d8
    2.14  nbproject/build-impl.xml.stylesheet.CRC32=99ea4b56@1.77.1.1
     3.1 --- a/nbproject/project.properties	Tue Dec 26 17:36:47 2017 +0100
     3.2 +++ b/nbproject/project.properties	Tue Dec 26 19:18:32 2017 +0100
     3.3 @@ -38,7 +38,8 @@
     3.4  jar.compress=false
     3.5  javac.classpath=\
     3.6      ${libs.jstl.classpath}:\
     3.7 -    ${libs.SLF4J-JDK.classpath}
     3.8 +    ${libs.SLF4J-LOG4J2.classpath}:\
     3.9 +    ${libs.LOG4J2-WEB.classpath}
    3.10  # Space-separated list of extra javac options
    3.11  javac.compilerargs=
    3.12  javac.debug=true
     4.1 --- a/nbproject/project.xml	Tue Dec 26 17:36:47 2017 +0100
     4.2 +++ b/nbproject/project.xml	Tue Dec 26 19:18:32 2017 +0100
     4.3 @@ -11,7 +11,11 @@
     4.4                      <path-in-war>WEB-INF/lib</path-in-war>
     4.5                  </library>
     4.6                  <library dirs="200">
     4.7 -                    <file>${libs.SLF4J-JDK.classpath}</file>
     4.8 +                    <file>${libs.SLF4J-LOG4J2.classpath}</file>
     4.9 +                    <path-in-war>WEB-INF/lib</path-in-war>
    4.10 +                </library>
    4.11 +                <library dirs="200">
    4.12 +                    <file>${libs.LOG4J2-WEB.classpath}</file>
    4.13                      <path-in-war>WEB-INF/lib</path-in-war>
    4.14                  </library>
    4.15              </web-module-libraries>
     5.1 --- a/src/java/de/uapcore/lightpit/AbstractLightPITServlet.java	Tue Dec 26 17:36:47 2017 +0100
     5.2 +++ b/src/java/de/uapcore/lightpit/AbstractLightPITServlet.java	Tue Dec 26 19:18:32 2017 +0100
     5.3 @@ -87,7 +87,7 @@
     5.4      private ResponseType invokeMapping(Method method, HttpServletRequest req, HttpServletResponse resp)
     5.5              throws IOException, ServletException {
     5.6          try {
     5.7 -            LOG.debug("invoke {}", method.getName());
     5.8 +            LOG.trace("invoke {}#{}", method.getDeclaringClass().getName(), method.getName());
     5.9              return (ResponseType) method.invoke(this, req, resp);
    5.10          } catch (ReflectiveOperationException | ClassCastException ex) {
    5.11              LOG.error(String.format("invocation of method %s failed", method.getName()), ex);
    5.12 @@ -242,6 +242,8 @@
    5.13              Locale sessionLocale = reqLocale.filter((rl) -> availableLanguages.map((al) -> al.contains(rl.getLanguage())).orElse(false)).orElse(Locale.ENGLISH);
    5.14              session.setAttribute(Constants.SESSION_ATTR_LANGUAGE, sessionLocale);
    5.15              LOG.debug("Settng language for new session {}: {}", session.getId(), sessionLocale.getDisplayLanguage());
    5.16 +        } else {
    5.17 +            LOG.trace("Continuing session {} with language {}", session.getId(), session.getAttribute(Constants.SESSION_ATTR_LANGUAGE));
    5.18          }
    5.19          
    5.20          req.setAttribute(Constants.REQ_ATTR_PATH, Functions.fullPath(req));
     6.1 --- a/src/java/de/uapcore/lightpit/modules/LanguageModule.java	Tue Dec 26 17:36:47 2017 +0100
     6.2 +++ b/src/java/de/uapcore/lightpit/modules/LanguageModule.java	Tue Dec 26 19:18:32 2017 +0100
     6.3 @@ -30,7 +30,6 @@
     6.4  
     6.5  import de.uapcore.lightpit.LightPITModule;
     6.6  import de.uapcore.lightpit.AbstractLightPITServlet;
     6.7 -import de.uapcore.lightpit.Constants;
     6.8  import de.uapcore.lightpit.Functions;
     6.9  import de.uapcore.lightpit.HttpMethod;
    6.10  import javax.servlet.annotation.WebServlet;
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/src/java/log4j2.properties	Tue Dec 26 19:18:32 2017 +0100
     7.3 @@ -0,0 +1,36 @@
     7.4 +# Copyright 2017 Mike Becker. All rights reserved.
     7.5 +#
     7.6 +# Redistribution and use in source and binary forms, with or without
     7.7 +# modification, are permitted provided that the following conditions are met:
     7.8 +#
     7.9 +# 1. Redistributions of source code must retain the above copyright
    7.10 +# notice, this list of conditions and the following disclaimer.
    7.11 +#
    7.12 +# 2. Redistributions in binary form must reproduce the above copyright
    7.13 +# notice, this list of conditions and the following disclaimer in the
    7.14 +# documentation and/or other materials provided with the distribution.
    7.15 +#
    7.16 +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    7.17 +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    7.18 +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
    7.19 +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
    7.20 +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    7.21 +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
    7.22 +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
    7.23 +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    7.24 +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    7.25 +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
    7.26 +
    7.27 +
    7.28 +status = warn
    7.29 +dest = err
    7.30 +name = PropertiesConfig
    7.31 + 
    7.32 +appender.console.type = Console
    7.33 +appender.console.name = STDOUT
    7.34 +appender.console.layout.type = PatternLayout
    7.35 +appender.console.layout.pattern = %d{ISO8601} %p - %M: %m %n
    7.36 + 
    7.37 +rootLogger.appenderRef.stdout.ref = STDOUT
    7.38 +
    7.39 +rootLogger.level = debug
     8.1 --- a/src/java/logging.properties	Tue Dec 26 17:36:47 2017 +0100
     8.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.3 @@ -1,27 +0,0 @@
     8.4 -# Copyright 2017 Mike Becker. All rights reserved.
     8.5 -#
     8.6 -# Redistribution and use in source and binary forms, with or without
     8.7 -# modification, are permitted provided that the following conditions are met:
     8.8 -#
     8.9 -# 1. Redistributions of source code must retain the above copyright
    8.10 -# notice, this list of conditions and the following disclaimer.
    8.11 -#
    8.12 -# 2. Redistributions in binary form must reproduce the above copyright
    8.13 -# notice, this list of conditions and the following disclaimer in the
    8.14 -# documentation and/or other materials provided with the distribution.
    8.15 -#
    8.16 -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    8.17 -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    8.18 -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
    8.19 -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
    8.20 -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    8.21 -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
    8.22 -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
    8.23 -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    8.24 -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    8.25 -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
    8.26 -
    8.27 -
    8.28 -handlers= java.util.logging.ConsoleHandler
    8.29 -
    8.30 -.level = DEBUG

mercurial