2011-09-29 24 views

回答

3
org.apache.log4j.LogManager.resetConfiguration(); 
if (System.getProperty("log4j.config") != null) { 
    DOMConfigurator.configureAndWatch(System.getProperty("log4j.config")); 
} 
else { 
    DOMConfigurator.configure(Loader.getResource("log4j.properties")); 
} 

使用此一次;您只有通過系統PARAMATERS指定路徑到你的log4j文件:

-Dlog4j.config=/path/to/your/log4j.properties 
+0

謝謝你安德烈亞斯... – Ranjith

+0

不客氣,如果能幫到你,請問你能否提出我的答案,甚至設置「解決問題的答案」?謝謝! – Andreas

1

嘗試

PropertyConfigurator.configure("configFilename") 
相關問題