A basic setup for Log4j when using Freemarker

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:


Happy logging and templating!!