0
votes

I have an ant build script that runs an RMI server (during dev testing), I recently switched to Log4J2 and was having issues with Log4J2 not finding the ant config file. Googling a bit and reveiwing other people trying to specify JVM arg's in ant - I've tried doing this:

<target name="win-server-run" depends="compile" description="Copies JAR file to server folder">
    <java classname="com.mycompany.server.Main" fork="yes" dir=".">
       <classpath refid="classpath-server-run"/>
        <jvmarg value="-Dlog4j.configurationFile=${project.dir}/resources/rmiServer/properties/classpath/log4j.properties"/>
    </java>
  </target>

With ${project.dir} being equal to C:\Users\Jay\Desktop\MyTesting\workspace-mytesting\MyApp\

But I'm getting the following error when running the ant task: [java] ERROR StatusLogger Invalid URL C:/Users/Jay/Desktop/MyTesting/workspace-mytesting/MyApp//resources/rmiServer/properties/classpath/log4j.properties [java] java.net.MalformedURLException: unknown protocol: c

It appears ant might be getting confused with the C: drive?

1

1 Answers

0
votes

I managed to get it working with this after finding a similar issue someone had. Just wanted to help others if need be!

<jvmarg value="-Dlog4j.configurationFile=file://${project.dir}/resources/rmiServer/properties/classpath/log4j.properties"/>

E.g. note the file://