Gourav Shivalkar
Gourav Shivalkar

Reputation: 83

Log4j.properties and log4j2.xml

Is it necessary to have both log4j.properties and log4j2.xml in a maven project to print logs to file?

Or is log4j2.xml sufficient?

Upvotes: 0

Views: 4933

Answers (1)

Alex Shesterov
Alex Shesterov

Reputation: 27525

log4j2.xml alone is sufficient.

Or, log4j2.properties alone would also be sufficient.

Note that if both log4j2.properties and log4j2.xml files are present on the classpath, log4j2.properties "wins". Or you can explicitly define which configuration file to load using the log4j.configurationFile system property.

See Log4j2 manual for details: https://logging.apache.org/log4j/2.x/manual/configuration.html

Upvotes: 2

Related Questions