Apr 222014
 
Article Java

Sometimes, the execution of a Java application may result in the following warning messages being output to the screen:

This means that the application is using the log4j API for the generation of tracing messages, but it couldn’t find the configuration file to initialize the logging subsystem.

We can get more information about this issue, adding the “-Dlog4j.debug” parameter:

As we can see, the system tries to find a file named “log4j.xml”, or “log4j.properties”, using the “classloader”.

Therefore, the file has to be put on any of the directories specified in the CLASSPATH variable. These are also the places where the system will look for the classes required to execute the application.

Alternatively, the location of the log4j configuration file can be explicitly specified by means of a parameter
-Dlog4j.configuration='path_to_log4j.properties':

 Posted by at 2:14 pm

 Leave a Reply

(required)

(required)