Skip to content

Commit

Permalink
copy and patch log4j version 2 config file during build process
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelwechner committed Sep 13, 2013
1 parent 73752d0 commit 5ccf898
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/build/targets/webapp/cluster.xml
Expand Up @@ -23,10 +23,17 @@
<replacetoken>log4j-cmdl.log</replacetoken>
</replace>
<touch file="${log4j.path}/log4j-cnode1.log"/>
<replace file="${tomcat1.webapps.dir}/${servlet.context.prefix}/WEB-INF/classes/log4j2.xml" value="log4j2-cnode1.log">
<replacetoken>log4j2-cmdl.log</replacetoken>
</replace>
<touch file="${log4j.path}/log4j2-cnode1.log"/>

<replace file="${tomcat1.webapps.dir}/${servlet.context.prefix}/WEB-INF/classes/log4j.properties" value="1">
<replacetoken>@CNODE_ID@</replacetoken>
</replace>
<replace file="${tomcat1.webapps.dir}/${servlet.context.prefix}/WEB-INF/classes/log4j2.xml" value="1">
<replacetoken>@CNODE_ID@</replacetoken>
</replace>

<touch file="${log4j.path}/404-cnode1.log"/>

Expand Down Expand Up @@ -156,10 +163,17 @@
<replacetoken>log4j-cmdl.log</replacetoken>
</replace>
<touch file="${log4j.path}/log4j-cnode2.log"/>
<replace file="${tomcat2.webapps.dir}/${servlet.context.prefix}/WEB-INF/classes/log4j2.xml" value="log4j2-cnode2.log">
<replacetoken>log4j2-cmdl.log</replacetoken>
</replace>
<touch file="${log4j.path}/log4j2-cnode2.log"/>

<replace file="${tomcat2.webapps.dir}/${servlet.context.prefix}/WEB-INF/classes/log4j.properties" value="2">
<replacetoken>@CNODE_ID@</replacetoken>
</replace>
<replace file="${tomcat2.webapps.dir}/${servlet.context.prefix}/WEB-INF/classes/log4j2.xml" value="2">
<replacetoken>@CNODE_ID@</replacetoken>
</replace>

<touch file="${log4j.path}/404-cnode2.log"/>

Expand Down
6 changes: 6 additions & 0 deletions src/build/targets/webapp/webapp.xml
Expand Up @@ -76,6 +76,7 @@
<copy file="${yanel.source.home}/conf/quartz.properties" todir="${build.dir}/webapps/${servlet.context.prefix}/WEB-INF/classes" overwrite="false"/>
<copy file="${yanel.source.home}/conf/jndi.properties" todir="${build.dir}/webapps/${servlet.context.prefix}/WEB-INF/classes" overwrite="false"/>
<copy file="${yanel.source.home}/conf/log4j.properties" todir="${build.dir}/webapps/${servlet.context.prefix}/WEB-INF/classes" overwrite="false"/>
<copy file="${yanel.source.home}/conf/log4j2.xml" todir="${build.dir}/webapps/${servlet.context.prefix}/WEB-INF/classes" overwrite="false"/>
<!-- Create yanel.xml -->
<condition property="local.yanel.config.exists">
<available file="${local.config.home}/local.yanel.xml" type="file"/>
Expand All @@ -94,10 +95,12 @@
<available file="${local.config.home}/local.log4j.properties" type="file"/>
</condition>
<antcall target="check-config-version-log4j-properties"/>
<!-- TODO: Check config version of log4j2.xml -->

<!-- Overwrite default by local properties -->
<!-- TODO: Make the patching selectable within the build.properties of the build ... -->
<copy file="${local.config.home}/local.log4j.properties" tofile="${build.dir}/webapps/${servlet.context.prefix}/WEB-INF/classes/log4j.properties" overwrite="true" failonerror="false"/>
<copy file="${local.config.home}/local.log4j2.xml" tofile="${build.dir}/webapps/${servlet.context.prefix}/WEB-INF/classes/log4j2.xml" overwrite="true" failonerror="false"/>
<copy file="${local.config.home}/local.realms.xml" tofile="${build.dir}/webapps/${servlet.context.prefix}/WEB-INF/classes/realms.xml" overwrite="true" failonerror="false"/>
<antcall target="patch-with-local-yanel-config"/>

Expand Down Expand Up @@ -149,6 +152,9 @@
<replace file="${build.dir}/webapps/${servlet.context.prefix}/WEB-INF/classes/log4j.properties" value="${log4j.dir.forward.slashes}">
<replacetoken>@LOG4J_DIR@</replacetoken>
</replace>
<replace file="${build.dir}/webapps/${servlet.context.prefix}/WEB-INF/classes/log4j2.xml" value="${log4j.dir.forward.slashes}">
<replacetoken>@LOG4J_DIR@</replacetoken>
</replace>
<touch file="${log4j.file}"/>
</target>

Expand Down

0 comments on commit 5ccf898

Please sign in to comment.