I removed the log4j2.properties file from resources, and instead made sure the working directory contained the file. Then it worked. Apparently it makes a difference whether the log4j2.properties file is loaded from resources or regular file?!