我有一個包中有幾個類,在我的項目中有幾個包。 對於繼承,父類中的這些文件是您需要多久設置一次log4j2的配置文件?
{ // File location for log4j2.xml
System.setProperty("log4j.configurationFile",
"file:\\\\" + System.getProperty("user.dir") + "\\Properties\\log4j2.xml");
}
然而,我看到ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console. Set system property 'log4j2.debug' to show Log4j2 internal initialization logging.
所以,很顯然,一次是不夠的。
那麼我需要設置log4j.configurationFile
的系統屬性的一般規則是什麼?
- 每包一次?
- 每班一次?
- 每個父母/基類,不管包?
- 還是別的什麼?
對於多個類和包,最佳實踐是什麼?