src/java/de/uapcore/lightpit/ModuleManager.java

changeset 8
2dfdb79b5344
parent 7
598670d5b0b8
child 9
20a9b2bc9063
--- 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