Struts and log4j config files outside war

Discussions

Web tier: servlets, JSP, Web frameworks: Struts and log4j config files outside war

  1. Scenario: A war file is going into 3 different environments (Dev, QA, and Prod). The configurations files "struts-config.xml", "ApplicationResources.properties", and "log4j_init.xml" contain different values depending on environment (e.g. log4j debugging is enabled in Dev and QA but disabled in Prod) which means I need to make 3 war files targeted to 3 environments. Is there a way to create just one war file for three environments? Is there a way for the above config files to be taken out of the war file and be deployed separately? This way I don’t need to repackage the war file when moving it from one environment to another. Thank you
  2. we implemented this in our appl i.e. our log4j file is external configuration. but our struts-config.xml and Applicationresources do not contain any environment specific configuration. In my opinion they should not. Instead we have a lot of other files that are environment specific. We keep all these files external to the war/ear file. In the appl we look for a System Property (System.getProperty("config.dir")) which points to the location of all these configuration files. In log4j we read the file using the following code:
    DOMConfigurator.configureAndWatch(file);
  3. An easy way to do this this define three directories dev,qa,prod and have utr log files or all related files for diff env in those I assume that u are using ant. Use ant input task to take the target env and based on the input, include the specific directory for the build Thanks