For example, for the log config, use this in web.xml:

        <listener>

<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
        </listener>
        <context-param>
                <param-name>log4jConfigLocation</param-name>
                <param-value>${log4j.configLocation}</param-value>
        </context-param>
        <context-param>
                <param-name>log4jRefreshInterval</param-name>
                <param-value>15000</param-value>
        </context-param>
        <context-param>
                <param-name>log4jExposeWebAppRoot</param-name>
                <param-value>false</param-value>
        </context-param>

Then execute your server with
-Dlog4j.configLocation=~/.myconfig/log4j.xml. Include another
log4j.xml in the deployed application, just in case (it will be
applied if the overriden location was not found).

With spring you can also  <import location="${mail.location}"/>, which
works with -d properties.

This is the spring solution, but most probably you can arrange
something similar with JEE or Guice. I think Grails is shipped with
something similar.

On Mon, Mar 1, 2010 at 3:48 PM, Federico Schroder <[email protected]> wrote:
>
>
> Ignacio Coloma wrote:
>>
>> Hi Federico,
>>
>> ${File.separator} is not needed, java.io.File will handle '/' no matter
>> the OS.
>>
>> On the other hand, I would think again if there are not better
>> alternatives to this. I used to prepare war files like you are doing,
>> and it's a headache. There are better alternatives, like using -D to
>> specify the environment you are interested in at runtime.
>>
>
> Hi Ignacio,
> Thx for the suggestion. I've consider this option and it's good for certain
> configurations, specially since it allows moving the same war around.
> However what about when the app needs to switch to another web.xml or change
> the log config as in this case? The only thing I can think of is some sort
> of preprocessing before starting the app and it seems really problematic to
> get in the middle of the expansion of the war file to do that.
> Did you have to do something like that? If so, how did you solve it?
>
> Federico
> --
> View this message in context: 
> http://old.nabble.com/WAR---per-environment-configuration-tp27693855p27744481.html
> Sent from the gradle-user mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to