java -Dlog4j.configuration command not working java -Dlog4j.configuration command not working hadoop hadoop

java -Dlog4j.configuration command not working


I had a same trouble and solved by reading the Log4j documentation.

Log4j will inspect the "log4j.configurationFile" system property and, if set, will attempt to load the configuration using the ConfigurationFactory that matches the file extension.

So the option name is "log4j.configurationFile", not "log4j.configuration".

My application is not Hadoop but just an Java Servlet. But I hope this post help you and others.


As far as I know log4j does not need a URL to its path.

Try this instead:

-Dlog4j.configuration=/home/user/log4j.properties

(Or whereever you stored the file)

Try to set up this before you start your application:

export JAVA_OPTS=-Dlog4j...

What you are trying to do is basically configuring java parameters. There are examples here on stackoverflow how to do this for other parameters, you will find more examples here: xlConnect R use of JVM memory