我有一个包中有几个类,在我的项目中有几个包。 对于继承,父类中的这些文件是您需要多久设置一次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
的系统属性的一般规则是什么?
- 每包一次?
- 每班一次?
- 每个父母/基类,不管包?
- 还是别的什么?
对于多个类和包,最佳实践是什么?