log4j.properties vs log4j.xml

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.

Leave a Comment