This is because the log4j.configuration
expects the file to be in the classpath, while log4j.configurationFile
expects it as a file path.
If you add -Dlog4j2.debug=true
to the VM arguments, you can see which file it is trying to load and will print its path. That way, you will have an indication of why the error is happening.