adds slf4j to project as netbeans library (make sure to have it configured in your environment)

Sun, 10 Dec 2017 16:10:14 +0100

author
Mike Becker <universe@uap-core.de>
date
Sun, 10 Dec 2017 16:10:14 +0100
changeset 8
2dfdb79b5344
parent 7
598670d5b0b8
child 9
20a9b2bc9063

adds slf4j to project as netbeans library (make sure to have it configured in your environment)

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/ModuleManager.java file | annotate | diff | comparison | revisions
     1.1 --- a/nbproject/build-impl.xml	Tue Nov 28 18:59:13 2017 +0100
     1.2 +++ b/nbproject/build-impl.xml	Sun Dec 10 16:10:14 2017 +0100
     1.3 @@ -998,11 +998,13 @@
     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          <mkdir dir="${build.web.dir}/META-INF"/>
     1.9          <manifest file="${build.web.dir}/META-INF/MANIFEST.MF" mode="update"/>
    1.10      </target>
    1.11      <target depends="init" name="library-inclusion-in-archive" unless="dist.ear.dir">
    1.12          <copyfiles files="${libs.jstl.classpath}" todir="${build.web.dir}/WEB-INF/lib"/>
    1.13 +        <copyfiles files="${libs.SLF4J-JDK.classpath}" todir="${build.web.dir}/WEB-INF/lib"/>
    1.14      </target>
    1.15      <target depends="init" if="dist.ear.dir" name="-clean-webinf-lib">
    1.16          <delete dir="${build.web.dir}/WEB-INF/lib"/>
     2.1 --- a/nbproject/genfiles.properties	Tue Nov 28 18:59:13 2017 +0100
     2.2 +++ b/nbproject/genfiles.properties	Sun Dec 10 16:10:14 2017 +0100
     2.3 @@ -1,8 +1,8 @@
     2.4 -build.xml.data.CRC32=2ce92825
     2.5 +build.xml.data.CRC32=343ad249
     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=2ce92825
    2.11 -nbproject/build-impl.xml.script.CRC32=db357bfe
    2.12 +nbproject/build-impl.xml.data.CRC32=343ad249
    2.13 +nbproject/build-impl.xml.script.CRC32=36eb4694
    2.14  nbproject/build-impl.xml.stylesheet.CRC32=99ea4b56@1.77.1.1
     3.1 --- a/nbproject/project.properties	Tue Nov 28 18:59:13 2017 +0100
     3.2 +++ b/nbproject/project.properties	Sun Dec 10 16:10:14 2017 +0100
     3.3 @@ -37,7 +37,8 @@
     3.4  j2ee.server.type=Tomcat
     3.5  jar.compress=false
     3.6  javac.classpath=\
     3.7 -    ${libs.jstl.classpath}
     3.8 +    ${libs.jstl.classpath}:\
     3.9 +    ${libs.SLF4J-JDK.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 Nov 28 18:59:13 2017 +0100
     4.2 +++ b/nbproject/project.xml	Sun Dec 10 16:10:14 2017 +0100
     4.3 @@ -10,6 +10,10 @@
     4.4                      <file>${libs.jstl.classpath}</file>
     4.5                      <path-in-war>WEB-INF/lib</path-in-war>
     4.6                  </library>
     4.7 +                <library dirs="200">
     4.8 +                    <file>${libs.SLF4J-JDK.classpath}</file>
     4.9 +                    <path-in-war>WEB-INF/lib</path-in-war>
    4.10 +                </library>
    4.11              </web-module-libraries>
    4.12              <web-module-additional-libraries/>
    4.13              <source-roots>
     5.1 --- a/src/java/de/uapcore/lightpit/ModuleManager.java	Tue Nov 28 18:59:13 2017 +0100
     5.2 +++ b/src/java/de/uapcore/lightpit/ModuleManager.java	Sun Dec 10 16:10:14 2017 +0100
     5.3 @@ -28,13 +28,13 @@
     5.4   */
     5.5  package de.uapcore.lightpit;
     5.6  
     5.7 -import java.util.logging.Level;
     5.8 -import java.util.logging.Logger;
     5.9  import javax.servlet.Registration;
    5.10  import javax.servlet.ServletContext;
    5.11  import javax.servlet.ServletContextEvent;
    5.12  import javax.servlet.ServletContextListener;
    5.13  import javax.servlet.annotation.WebListener;
    5.14 +import org.slf4j.Logger;
    5.15 +import org.slf4j.LoggerFactory;
    5.16  
    5.17  /**
    5.18   * Scans registered servlets for LightPIT modules.
    5.19 @@ -42,7 +42,7 @@
    5.20  @WebListener
    5.21  public class ModuleManager implements ServletContextListener {
    5.22      
    5.23 -    private static final Logger LOG = Logger.getLogger(ModuleManager.class.getName());
    5.24 +    private static final Logger LOG = LoggerFactory.getLogger(ModuleManager.class);
    5.25      
    5.26      /**
    5.27       * The attribute name in the servlet context under which an instance of this class can be found.
    5.28 @@ -74,29 +74,32 @@
    5.29              final boolean lpmodule = scclass.isAnnotationPresent(LightPITModule.class);
    5.30              
    5.31              if (lpservlet && !lpmodule) {
    5.32 -                LOG.log(Level.WARNING,
    5.33 -                    "Servlet is a LightPITServlet but is missing the module annotation: {0}",
    5.34 -                    reg.getClassName());
    5.35 +                LOG.warn(
    5.36 +                    "Servlet is a LightPITServlet but is missing the module annotation: {}",
    5.37 +                    reg.getClassName()
    5.38 +                );
    5.39              } else if (!lpservlet && lpmodule) {
    5.40 -                LOG.log(Level.WARNING,
    5.41 -                    "Servlet is annotated as a LightPITModule but does not extend LightPITServlet: {0}",
    5.42 -                    reg.getClassName());
    5.43 +                LOG.warn(
    5.44 +                    "Servlet is annotated as a LightPITModule but does not extend LightPITServlet: {}",
    5.45 +                    reg.getClassName()
    5.46 +                );
    5.47              }
    5.48              
    5.49              return lpservlet && lpmodule;
    5.50          } catch (ClassNotFoundException ex) {
    5.51 -            LOG.log(Level.SEVERE,
    5.52 -                    "Servlet registration refers to a class which cannot be found by the class loader: {0}",
    5.53 -                    reg.getClassName());
    5.54 +            LOG.error(
    5.55 +                    "Servlet registration refers to a class which cannot be found by the class loader: {}",
    5.56 +                    reg.getClassName()
    5.57 +            );
    5.58              return false;
    5.59          }        
    5.60      }
    5.61      
    5.62      private void handleServletRegistration(String name, Registration reg) {
    5.63          if (isRegisteredAsModule(reg)) {
    5.64 -            LOG.log(Level.CONFIG, "Module detected: {0}", name);
    5.65 +            LOG.info("Module detected: {}", name);
    5.66          } else {
    5.67 -            LOG.log(Level.FINE, "Servlet {0} is no module, skipping.", name);
    5.68 +            LOG.debug("Servlet {} is no module, skipping.", name);
    5.69          }
    5.70      }
    5.71      

mercurial