Windows - Ant、Log4J2 配置文件 JVM 参数
Windows - Ant, Log4J2 ConfigurationFile JVM Argument
我有一个运行 RMI 服务器的 ant 构建脚本(在开发测试期间),我最近切换到 Log4J2 并且遇到 Log4J2 找不到 ant 配置文件的问题。谷歌搜索一下并回顾其他人试图在 ant 中指定 JVM arg - 我试过这样做:
<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>
${project.dir}等于
C:\Users\Jay\Desktop\MyTesting\workspace-mytesting\MyApp\
但是当 运行 ant 任务时,我收到以下错误:
[java] 错误 StatusLogger 无效 URL C:/Users/Jay/Desktop/MyTesting/workspace-mytesting/MyApp//resources/rmiServer/properties/classpath/log4j.properties
[java] java.net.MalformedURLException: 未知协议: c
ant 似乎与 C: 驱动器混淆了?
在发现有人遇到过类似问题后,我设法让它工作。只是想在需要时帮助别人!
<jvmarg value="-Dlog4j.configurationFile=file://${project.dir}/resources/rmiServer/properties/classpath/log4j.properties"/>
例如注意文件://
我有一个运行 RMI 服务器的 ant 构建脚本(在开发测试期间),我最近切换到 Log4J2 并且遇到 Log4J2 找不到 ant 配置文件的问题。谷歌搜索一下并回顾其他人试图在 ant 中指定 JVM arg - 我试过这样做:
<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>
${project.dir}等于 C:\Users\Jay\Desktop\MyTesting\workspace-mytesting\MyApp\
但是当 运行 ant 任务时,我收到以下错误: [java] 错误 StatusLogger 无效 URL C:/Users/Jay/Desktop/MyTesting/workspace-mytesting/MyApp//resources/rmiServer/properties/classpath/log4j.properties [java] java.net.MalformedURLException: 未知协议: c
ant 似乎与 C: 驱动器混淆了?
在发现有人遇到过类似问题后,我设法让它工作。只是想在需要时帮助别人!
<jvmarg value="-Dlog4j.configurationFile=file://${project.dir}/resources/rmiServer/properties/classpath/log4j.properties"/>
例如注意文件://