Hello I am trying to log information of my application.
I am using Loj4j and I see this tutorial:
http://www.laliluna.de/articles/posts/log4j-tutorial.html
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:
import org.apache.log4j.Logger;
private static org.apache.log4j.Logger log = org.apache.log4j.Logger.getLogger(ConexionPL.class);
Public void method()
{
log.trace("mesg");
}
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.
log4j.rootLogger=ERROR,INFO,A1,file
log4j.appender.A1=org.apache.log4j.ConsoleAppender
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%d{ISO8601} %5p [%t] %c{1}:%L - %m%n
log4j.appender.file=org.apache.log4j.RollingFileAppender
log4j.appender.file.maxFileSize=5000KB
log4j.appender.file.maxBackupIndex=20
log4j.appender.file.File=/u01/tomcat/logs/FOLDER/FILE.log
log4j.appender.file.threshold=ERROR
log4j.appender.file.threshold=INFO
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{ISO8601} %5p [%t] %c{1}:%L - %m%n
The strage here is that the fode in the JAVA class is never executed, right? I don´t understand why is the exception.
Any help?
Please let me know if you have any questions, and sorry for my english.
BR,
Andrés.