diff flys-client/src/main/java/de/intevation/flys/client/server/BaseServlet.java @ 1372:2ba44c1b2bab

Added a environment variable that might be used to use an alternative log4j properties file. flys-client/trunk@3081 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 26 Oct 2011 09:06:09 +0000
parents ec0c81f2c7a4
children 42d6cf6e10b7
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/server/BaseServlet.java	Wed Oct 26 08:28:02 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/BaseServlet.java	Wed Oct 26 09:06:09 2011 +0000
@@ -12,6 +12,9 @@
     private static Logger logger = Logger.getLogger(BaseServlet.class);
 
 
+    public static final String LOG4J_PROPERTIES = "FLYS_CLIENT_LOG4J_PROPERIES";
+
+
     @Override
     public void init()
     throws ServletException
@@ -24,13 +27,18 @@
 
 
     protected void initLogging() {
-        String log4jProperties = getInitParameter("log4j-properties");
+        String log4jProperties = System.getenv(LOG4J_PROPERTIES);
+
+        if (log4jProperties == null || log4jProperties.length() == 0) {
+            String file = getInitParameter("log4j-properties");
+
+            if (file != null && file.length() > 0) {
+                log4jProperties = getServletContext().getRealPath(file);
+            }
+        }
 
         if (log4jProperties != null && log4jProperties.length() > 0) {
-            String file = getServletContext().getRealPath(log4jProperties);
-
-            PropertyConfigurator.configure(file);
-
+            PropertyConfigurator.configure(log4jProperties);
             logger.info("Log4J logging initialized.");
         }
         else {

http://dive4elements.wald.intevation.org