The problem is when I run the servlet without any log4j code says:
log4j:WARN No appenders could be found for logger (com.mchange.v2.log.MLog).
log4j:WARN Please initialize the log4j system properly.
20/06/2012 08:14:45 PM org.apache.catalina.core.StandardService start
The code in a JAVA class(it is not a Servlet) to save in a log file is:
The log4j.properties is in the root of the project(inside the SRC folder)
Here is the log4j.properties file:
# For the general syntax of property based configuration files see the
# documenation of org.apache.log4j.PropertyConfigurator.
In that example, the property file is set up to ERROR (the most stringent level of logging), but the code only logs on a trace level. It shouldn't log.
As you note, it is even getting there. Not being able to configure logging looks like is being treated as a fatal error so you aren't getting to the method. Do you have the log4j property file in your path?