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
--- a/nbproject/build-impl.xml	Tue Nov 28 18:59:13 2017 +0100
+++ b/nbproject/build-impl.xml	Sun Dec 10 16:10:14 2017 +0100
@@ -998,11 +998,13 @@
     <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"/>
         <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"/>
     </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 Nov 28 18:59:13 2017 +0100
+++ b/nbproject/genfiles.properties	Sun Dec 10 16:10:14 2017 +0100
@@ -1,8 +1,8 @@
-build.xml.data.CRC32=2ce92825
+build.xml.data.CRC32=343ad249
 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=2ce92825
-nbproject/build-impl.xml.script.CRC32=db357bfe
+nbproject/build-impl.xml.data.CRC32=343ad249
+nbproject/build-impl.xml.script.CRC32=36eb4694
 nbproject/build-impl.xml.stylesheet.CRC32=99ea4b56@1.77.1.1
--- a/nbproject/project.properties	Tue Nov 28 18:59:13 2017 +0100
+++ b/nbproject/project.properties	Sun Dec 10 16:10:14 2017 +0100
@@ -37,7 +37,8 @@
 j2ee.server.type=Tomcat
 jar.compress=false
 javac.classpath=\
-    ${libs.jstl.classpath}
+    ${libs.jstl.classpath}:\
+    ${libs.SLF4J-JDK.classpath}
 # Space-separated list of extra javac options
 javac.compilerargs=
 javac.debug=true
--- a/nbproject/project.xml	Tue Nov 28 18:59:13 2017 +0100
+++ b/nbproject/project.xml	Sun Dec 10 16:10:14 2017 +0100
@@ -10,6 +10,10 @@
                     <file>${libs.jstl.classpath}</file>
                     <path-in-war>WEB-INF/lib</path-in-war>
                 </library>
+                <library dirs="200">
+                    <file>${libs.SLF4J-JDK.classpath}</file>
+                    <path-in-war>WEB-INF/lib</path-in-war>
+                </library>
             </web-module-libraries>
             <web-module-additional-libraries/>
             <source-roots>
--- a/src/java/de/uapcore/lightpit/ModuleManager.java	Tue Nov 28 18:59:13 2017 +0100
+++ b/src/java/de/uapcore/lightpit/ModuleManager.java	Sun Dec 10 16:10:14 2017 +0100
@@ -28,13 +28,13 @@
  */
 package de.uapcore.lightpit;
 
-import java.util.logging.Level;
-import java.util.logging.Logger;
 import javax.servlet.Registration;
 import javax.servlet.ServletContext;
 import javax.servlet.ServletContextEvent;
 import javax.servlet.ServletContextListener;
 import javax.servlet.annotation.WebListener;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * Scans registered servlets for LightPIT modules.
@@ -42,7 +42,7 @@
 @WebListener
 public class ModuleManager implements ServletContextListener {
     
-    private static final Logger LOG = Logger.getLogger(ModuleManager.class.getName());
+    private static final Logger LOG = LoggerFactory.getLogger(ModuleManager.class);
     
     /**
      * The attribute name in the servlet context under which an instance of this class can be found.
@@ -74,29 +74,32 @@
             final boolean lpmodule = scclass.isAnnotationPresent(LightPITModule.class);
             
             if (lpservlet && !lpmodule) {
-                LOG.log(Level.WARNING,
-                    "Servlet is a LightPITServlet but is missing the module annotation: {0}",
-                    reg.getClassName());
+                LOG.warn(
+                    "Servlet is a LightPITServlet but is missing the module annotation: {}",
+                    reg.getClassName()
+                );
             } else if (!lpservlet && lpmodule) {
-                LOG.log(Level.WARNING,
-                    "Servlet is annotated as a LightPITModule but does not extend LightPITServlet: {0}",
-                    reg.getClassName());
+                LOG.warn(
+                    "Servlet is annotated as a LightPITModule but does not extend LightPITServlet: {}",
+                    reg.getClassName()
+                );
             }
             
             return lpservlet && lpmodule;
         } catch (ClassNotFoundException ex) {
-            LOG.log(Level.SEVERE,
-                    "Servlet registration refers to a class which cannot be found by the class loader: {0}",
-                    reg.getClassName());
+            LOG.error(
+                    "Servlet registration refers to a class which cannot be found by the class loader: {}",
+                    reg.getClassName()
+            );
             return false;
         }        
     }
     
     private void handleServletRegistration(String name, Registration reg) {
         if (isRegisteredAsModule(reg)) {
-            LOG.log(Level.CONFIG, "Module detected: {0}", name);
+            LOG.info("Module detected: {}", name);
         } else {
-            LOG.log(Level.FINE, "Servlet {0} is no module, skipping.", name);
+            LOG.debug("Servlet {} is no module, skipping.", name);
         }
     }
     

mercurial