I have written a simple Java class and inlcuded log4j.jar in the classpath.
In log4j.properties I have written
log4j.rootCategory=DEBUG, C:\\logger.txt
log4j.appender.dest1=org.apache.log4j.ConsoleAppender
log4j.appender.dest1.layout=org.apache.log4j.PatternLayout
and in my class I have written
import org.apache.log4j.*;
public class myclass {
static Logger logger = Logger.getLogger(myclass .class);
public static void main(String[] args) {
logger.debug("111111111111111111111111111");
}
But I am getting the following error
log4j:ERROR Could not find value for key log4j.appender.C:\logger.txt
log4j:ERROR Could not instantiate appender named "C:\logger.txt".
log4j:WARN No appenders could be found for logger (com.myclass).
log4j:WARN Please initialize the log4j system properly.
Also nothing gets written to logger.txt
How can I fix this.
ASKER
static Logger logger = Logger.getLogger(myclass .class);
to
static Logger logger = Logger.getLogger(com.mycla
where com is the package name but still same problem.