struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lukaszlen...@apache.org
Subject svn commit: r1433650 - /struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/DefaultStaticContentLoader.java
Date Tue, 15 Jan 2013 21:09:02 GMT
Author: lukaszlenart
Date: Tue Jan 15 21:09:01 2013
New Revision: 1433650

URL: http://svn.apache.org/viewvc?rev=1433650&view=rev
Log:
WW-3962 removes duplicated initialisation of loggerFactory

Modified:
    struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/DefaultStaticContentLoader.java

Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/DefaultStaticContentLoader.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/DefaultStaticContentLoader.java?rev=1433650&r1=1433649&r2=1433650&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/DefaultStaticContentLoader.java
(original)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/DefaultStaticContentLoader.java
Tue Jan 15 21:09:01 2013
@@ -62,10 +62,11 @@ import java.util.StringTokenizer;
  * <p/>
  */
 public class DefaultStaticContentLoader implements StaticContentLoader {
+
     /**
      * Provide a logging instance.
      */
-    private Logger log;
+    private Logger LOG = LoggerFactory.getLogger(DefaultStaticContentLoader.class);
 
     /**
      * Store set of path prefixes to use with static resources.
@@ -137,7 +138,6 @@ public class DefaultStaticContentLoader 
             packages = param + " " + packages;
         }
         this.pathPrefixes = parse(packages);
-        initLogging(filterConfig);
     }
 
     protected String getAdditionalPackages() {
@@ -213,8 +213,9 @@ public class DefaultStaticContentLoader 
             try {
                 ifModifiedSince = request.getDateHeader("If-Modified-Since");
             } catch (Exception e) {
-                log.warn("Invalid If-Modified-Since header value: '"
-                        + request.getHeader("If-Modified-Since") + "', ignoring");
+                if (LOG.isWarnEnabled()) {
+                    LOG.warn("Invalid If-Modified-Since header value: '#0', ignoring", request.getHeader("If-Modified-Since"));
+                }
             }
             long lastModifiedMillis = lastModifiedCal.getTimeInMillis();
             long now = cal.getTimeInMillis();
@@ -257,29 +258,6 @@ public class DefaultStaticContentLoader 
         }
     }
 
-    private void initLogging(HostConfig filterConfig) {
-        String factoryName = filterConfig.getInitParameter("loggerFactory");
-        if (factoryName != null) {
-            try {
-                Class cls = ClassLoaderUtil.loadClass(factoryName, this.getClass());
-                LoggerFactory fac = (LoggerFactory)cls.newInstance();
-                LoggerFactory.setLoggerFactory(fac);
-            } catch (InstantiationException e) {
-                System.err.println("Unable to instantiate logger factory: "+factoryName+",
using default");
-                e.printStackTrace();
-            } catch (IllegalAccessException e) {
-                System.err.println("Unable to access logger factory: "+factoryName+", using
default");
-                e.printStackTrace();
-            } catch (ClassNotFoundException e) {
-                System.err.println("Unable to locate logger factory class: "+factoryName+",
using default");
-                e.printStackTrace();
-            }
-        }
-
-        log = LoggerFactory.getLogger(DefaultStaticContentLoader.class);
-
-    }
-
     /**
      * Look for a static resource in the classpath.
      *



Mime
View raw message