So I’m using Log4j in a project I’m working on, and I kept getting warnings from log4j when starting to use Freemarker…
log4j:WARN No appenders could be found for logger (freemarker.cache).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
In order to resolve these issues, I had to import the following classes:
import freemarker.log.Logger;
import org.apache.log4j.BasicConfigurator;
…And run the following commands:
Logger.selectLoggerLibrary(Logger.LIBRARY\_LOG4J);
BasicConfigurator.configure();
Happy logging and templating!!
—
#### Bill -
Hi- Thanks for posting this, I am getting the same error and hope that your solution will solve my issue as well. When you say, “and run the following commands…”, where exactly did you run those commands, or put those lines in your code? Thanks in advance, -Bill