% ant -buildfile commons-logging-to-log4j.xml -projecthelp Buildfile: commons-logging-to-log4j.xml Main targets:
convert convert source from commons-logging to
log4j apis install-log4j-properties copy log4j properties to classes dir make-src-backup make src.orig directory revert Put original java source code back uninstall-log4j-properties remove log4j properties from classes dir
With some massaging, these targets could probably be renamed and merged into build.xml and maintained there (and probably belong there). Also, in my envirionment, I used a build.properties that has ${commons-logging.jar} pointing to a copy of log4j.jar. If I were going to maintain this inside the commons-httpclient/build.*, I'd rename the commons-logging.jar property to ${logging-jar}, too, so things would make a little more sense.
I ran the tests and it seems to basically work. I can now, happily say 'bubbye' to commons-logging.
Enjoy -Eric
<!-- Ant build file to convert httpclient java source code from commons-logging api to direct use of log4j. Known to work with httpclient 2.0.1 src base. --> <project name="httpclient-commons-logging-to-log4j" default="convert" basedir=".">
<target name="make-src-backup" description="make src.orig directory"> <mkdir dir="src.orig" /> <copy todir="src.orig" > <fileset dir="src" /> </copy> </target> <target name="convert" depends="make-src-backup" description="convert source from commons-logging to log4j apis"> <replace dir="src" > <replacefilter token="org.apache.commons.logging.LogFactory" value="org.apache.log4j.Logger" /> <replacefilter token="org.apache.commons.logging.Log" value="org.apache.log4j.Level" /> <replacefilter token="LogFactory.getLog" value="Logger.getLogger" /> <replacefilter token="LOG.trace" value="LOG.debug" /> <replacefilter token="isTraceEnabled" value="isDebugEnabled" /> <replacefilter token="isErrorEnabled()" value="isEnabledFor(Level.ERROR)" /> <replacefilter token="isWarnEnabled()" value="isEnabledFor(Level.WARN)" /> <replacefilter token="Log " value="Logger " /> </replace> </target> <!-- Useful while running tests --> <target name="install-log4j-properties" description="copy log4j properties to classes dir"> <copy file="src/conf/log4j.properties.sample" tofile="target/classes/log4j.properties"/> </target> <!-- But we don't want to ship this file so remove it --> <target name="uninstall-log4j-properties" description="remove log4j properties from classes dir"> <delete file="target/classes/log4j.properties"/> </target> <target name="revert" description="Put original java source code back"> <move todir="src" > <fileset dir="src.orig" /> </move> </target> </project>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]