I am trying to use log4j via commons-logging and having problems if the log4j properties file is not called log4.properties. I get following error: log4j:WARN No appenders could be found for logger (LogMePlease). log4j:WARN Please initialize the log4j system properly.
My code is very simple:
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public class LogMePlease
{
static Log l = LogFactory.getLog(LogMePlease.class);
public static void main(String [] args)
{
l.warn("Hello World!");
}
}
In my class path, i have: commons-logging.properties file which contains following entries
org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger
log4j.configuration=log4j-test.properties
and log4j-test.properties file
when i run this code i get
log4j:WARN No appenders could be found for logger (LogMePlease).
log4j:WARN Please initialize the log4j system properly.
If I rename log4j-test.properties file to be log4j.properties - then everything works. So, the question is how can I setup commons logging to use arbitrary name for log4j.properties file.