如果您使用这样的语法-Dlog4j.configuration=mylog4j.properties该文件应在类路径中.但是您也可以使用这样的语法-Dlog4j.configuration=file:/<path>/mylog4j.properties指定完全限定的文件位置.I'm using the Cargo Maven plugin to deploy a WAR to a remote server, and I'm having problems. I'll probably create a second question for that problem, but this one is about overriding a Maven plugin's log4j configuration. Cargo uses JBoss' client libraries to ship stuff to JBoss servers (which I'm trying to do.) The JBoss library uses log4j. Cargo doesn't set up any sort of mapping layer that I know of.So, essentially, log messages are occurring in the dependent library of a Maven plugin. I tried setting -Dlog4j.debug and got this information:Then I tried setting -Dlog4j.configuration=mylog4j.properties but got this:It would appear that the log4j configuration file needs to be in the Maven plugin's classpath, but I don't know how to include random files there, only dependencies. I really want to set this information so that I can get debug information from the JBoss libraries in order to troubleshoot my problem. 解决方案 With log4j.configuration you will set a resource string. Have a look at the log4j default initialization process and the examples.If you use a syntax like this-Dlog4j.configuration=mylog4j.propertiesthe file is expected in the classpath. But you can also use a syntax like this-Dlog4j.configuration=file:/<path>/mylog4j.propertiesto specify a fully qualified file location. 这篇关于如何覆盖Maven插件的log4j配置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
07-29 19:46
查看更多