Log4j.properties and log4j2.xml



在maven 项目中是否需要同时具有log4j.propertieslog4j2.xml才能将日志打印到文件?

还是log4j2.xml足够?

log4j2.xml就足够了。

或者,仅log4j2.properties也足够了。

请注意,如果类路径上同时存在log4j2.propertieslog4j2.xml文件,则log4j2.properties"获胜"。或者,您可以使用log4j.configurationFilesystem 属性显式定义要加载的配置文件。

有关详细信息,请参阅 Log4j2 手册:https://logging.apache.org/log4j/2.x/manual/configuration.html

最新更新