# HG changeset patch # User Ingo Weinzierl # Date 1319619969 0 # Node ID 2ba44c1b2bab10d573d249d65c242c32ff6d0105 # Parent 2582c06c37746d982a67f74eff32aaeb86a0ece9 Added a environment variable that might be used to use an alternative log4j properties file. flys-client/trunk@3081 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 2582c06c3774 -r 2ba44c1b2bab flys-client/ChangeLog --- a/flys-client/ChangeLog Wed Oct 26 08:28:02 2011 +0000 +++ b/flys-client/ChangeLog Wed Oct 26 09:06:09 2011 +0000 @@ -1,3 +1,10 @@ +2011-10-26 Ingo Weinzierl + + * src/main/java/de/intevation/flys/client/server/BaseServlet.java: Added a + an environment variable FLYS_CLIENT_LOG4J_PROPERIES that might be used + to use an alternative log4j.properties instead of the default one which + comes with the SVN. This variable needs to point to a properties file. + 2011-10-26 Ingo Weinzierl * .: Modified svn:ignore property to ignore log4j.properties. diff -r 2582c06c3774 -r 2ba44c1b2bab flys-client/src/main/java/de/intevation/flys/client/server/BaseServlet.java --- 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 {