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

changeset 8
2dfdb79b5344
parent 7
598670d5b0b8
child 9
20a9b2bc9063
     1.1 --- a/src/java/de/uapcore/lightpit/ModuleManager.java	Tue Nov 28 18:59:13 2017 +0100
     1.2 +++ b/src/java/de/uapcore/lightpit/ModuleManager.java	Sun Dec 10 16:10:14 2017 +0100
     1.3 @@ -28,13 +28,13 @@
     1.4   */
     1.5  package de.uapcore.lightpit;
     1.6  
     1.7 -import java.util.logging.Level;
     1.8 -import java.util.logging.Logger;
     1.9  import javax.servlet.Registration;
    1.10  import javax.servlet.ServletContext;
    1.11  import javax.servlet.ServletContextEvent;
    1.12  import javax.servlet.ServletContextListener;
    1.13  import javax.servlet.annotation.WebListener;
    1.14 +import org.slf4j.Logger;
    1.15 +import org.slf4j.LoggerFactory;
    1.16  
    1.17  /**
    1.18   * Scans registered servlets for LightPIT modules.
    1.19 @@ -42,7 +42,7 @@
    1.20  @WebListener
    1.21  public class ModuleManager implements ServletContextListener {
    1.22      
    1.23 -    private static final Logger LOG = Logger.getLogger(ModuleManager.class.getName());
    1.24 +    private static final Logger LOG = LoggerFactory.getLogger(ModuleManager.class);
    1.25      
    1.26      /**
    1.27       * The attribute name in the servlet context under which an instance of this class can be found.
    1.28 @@ -74,29 +74,32 @@
    1.29              final boolean lpmodule = scclass.isAnnotationPresent(LightPITModule.class);
    1.30              
    1.31              if (lpservlet && !lpmodule) {
    1.32 -                LOG.log(Level.WARNING,
    1.33 -                    "Servlet is a LightPITServlet but is missing the module annotation: {0}",
    1.34 -                    reg.getClassName());
    1.35 +                LOG.warn(
    1.36 +                    "Servlet is a LightPITServlet but is missing the module annotation: {}",
    1.37 +                    reg.getClassName()
    1.38 +                );
    1.39              } else if (!lpservlet && lpmodule) {
    1.40 -                LOG.log(Level.WARNING,
    1.41 -                    "Servlet is annotated as a LightPITModule but does not extend LightPITServlet: {0}",
    1.42 -                    reg.getClassName());
    1.43 +                LOG.warn(
    1.44 +                    "Servlet is annotated as a LightPITModule but does not extend LightPITServlet: {}",
    1.45 +                    reg.getClassName()
    1.46 +                );
    1.47              }
    1.48              
    1.49              return lpservlet && lpmodule;
    1.50          } catch (ClassNotFoundException ex) {
    1.51 -            LOG.log(Level.SEVERE,
    1.52 -                    "Servlet registration refers to a class which cannot be found by the class loader: {0}",
    1.53 -                    reg.getClassName());
    1.54 +            LOG.error(
    1.55 +                    "Servlet registration refers to a class which cannot be found by the class loader: {}",
    1.56 +                    reg.getClassName()
    1.57 +            );
    1.58              return false;
    1.59          }        
    1.60      }
    1.61      
    1.62      private void handleServletRegistration(String name, Registration reg) {
    1.63          if (isRegisteredAsModule(reg)) {
    1.64 -            LOG.log(Level.CONFIG, "Module detected: {0}", name);
    1.65 +            LOG.info("Module detected: {}", name);
    1.66          } else {
    1.67 -            LOG.log(Level.FINE, "Servlet {0} is no module, skipping.", name);
    1.68 +            LOG.debug("Servlet {} is no module, skipping.", name);
    1.69          }
    1.70      }
    1.71      

mercurial