log4j.properties vs log4j.xml

前端 未结 2 1096
甜味超标
甜味超标 2020-12-23 18:04

I was asked to move from properties style configuration to xml style. The process itself is straightforward and it is not causing me any trouble, I was simply curious why I

2条回答
  •  别那么骄傲
    2020-12-23 18:11

    Have a look at the JavaDoc. The documentation of the PropertyConfiguratorClass (log4j.properties) points out that

    The PropertyConfigurator does not handle the advanced configuration features supported by the DOMConfigurator such as support custom ErrorHandlers, nested appenders such as the AsyncAppender, etc.

    So the DOMConfigurator (log4j.xml) offers advanced options.

    Beside that you can have (at least a simple) validity check of log4j.xml files using the provided log4j.dtd.

    If youd do not make use of the advanced features it is needless to change from properties to xml files.

    What you really should think about is to change from log4j to log4j 2 beta or even slf4j. Development of log4j has stopped and the founder of it (@Ceki) invented slf4j.

提交回复
热议问题