The configuration in the question uses the log4j-1.2 format.
Log4j-2.0 uses a different XML format. The configuration file should also be called log4j2.xml
instead of log4j.xml
. The easiest way to configure is to put the log4j2.xml
file in the classpath.
The online docs have many example configurations: for example for File Appender, and the Console.
Note that you need both the log4j-api-2.0 and log4j-core-2.0 jar files in the classpath.