tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Richard Mixon" <rnmi...@qwest.net>
Subject RE: Best Practice for properties files
Date Sun, 25 Jun 2006 01:44:24 GMT
Paul, are you using the deployer application to deploy your app (e.g.
apache-tomcat-5.5.17-deployer)?

If so, then it is very easy to modify the build.xml to customize the
log4j.properties, app.properties and any other file, and then deploy it
properly. You could even have a different ant target for each different
instance of the webapp.war file.

Here's an example of the build.xml that we setup. In this case most of the
example deals with setting the JDBC connection to the correct database.

HTH - Richard

  ...
  <!-- ===================================================================
-->
  <!-- Deploy for development (basically customize and copy to webapps dir
-->
  <!-- ===================================================================
-->
  <target name="devDeploy" description="Development Deploy"
          depends="clean,customizeContext">

  ... <!--- note we added the "customizeContext" target in the above depends
-->

  <!-- The target below can have anything you wish in it -->
  <!-- ===================================================================
-->
  <!-- Customize context for web application
-->
  <!-- ===================================================================
-->
  <target name="customizeContext"
      description="Customizes web application context if its stored in
META-INF/${webapp}.xml">
      <!-- Customizing ${webapp.path}/META-INF/${webapp}.xml -->
      <echo level="info">Customizing
${webapp.path}/META-INF/${webapp}.xml</echo>
      <move tofile="${webapp}/META-INF/context.xml_bak"
              file="${webapp}/META-INF/context.xml"
         overwrite="false" failonerror="false"/>
      <delete file="${webapp}/META-INF/context.xml" failonerror="false"/>
      <echo level="info">Changing hibernate.connection.driver_class to
${jdbc.connection.driver_class}</echo>
      <copy tofile="${webapp}/META-INF/context.xml"
              file="${webapp}/META-INF/context.xml_bak"
              overwrite="true" failonerror="true" verbose="true">
            <filterset>
                <filter token="webapp.name" value="${webapp.name}"/>
                <filter token="docbase.dir" value="${docbase.dir}"/>
                <filter token="workdir.dir" value="${workdir.dir}"/>
                <filter token="database.url" value="${database.url}"/>
                <filter token="app.username" value="${app.username}"/>
                <filter token="app.password" value="${app.password}"/>
            </filterset>
      </copy>
      ...
  </target>

-----Original Message-----
From: Paul Mendelson [mailto:pmendelson@plexsci.com] 
Sent: Friday, June 23, 2006 9:46 AM
To: Tomcat Users List
Subject: Best Practice for properties files

I have a fairly normal application that I am deploying on a tomcat 5.5
server.

My application uses log4j for its internal logging and I have a
log4j.properties file that I keep in web/WEB-INF/classes.  I also have a
regular app.properties file that I keep in web/WEB-INF.

I deploy my application to my tomcat server by placing app.war in the proper
directory.

My question is if I am running my application on 4 or 5 different tomcat
servers and toe log4j.properties and app.properties file needs to be set up
different on each server what is the best way to deploy and maintain those
files?  I very much want to create a single app.war file and let each system
administrator customer there properties without needing to synchronize with
me.

Any advice is appreciated.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe,
e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message