I have an Eclipse Java Project which uses log4j. I can\'t set the log4j configuration file to be accessed by file path. I have to export and run the project in a jar.
He
You can set VM argument : -Dlog4j.configuration='path_to_log4j.xml'
or programatically :
String logFilePath = new File();
if (logFilePath == null || "".equalsIgnoreCase(logFilePath)) {
URL file = this.getClass().getResource(DEFAULT_CONF);
DOMConfigurator.configure(file);
} else {
DOMConfigurator.configure();
}