configure log4j to log to custom file at runtime

Adapted from the log4j documentation:

import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.apache.log4j.SimpleLayout;
import org.apache.log4j.FileAppender;

public class SimpandFile {
   static Logger logger = Logger.getLogger(SimpandFile.class);
   public static void main(String args[]) {

      // setting up a FileAppender dynamically...
      SimpleLayout layout = new SimpleLayout();    
      FileAppender appender = new FileAppender(layout,"your filename",false);    

      logger.setLevel((Level) Level.DEBUG);

      logger.debug("Here is some DEBUG");"Here is some INFO");
      logger.warn("Here is some WARN");
      logger.error("Here is some ERROR");
      logger.fatal("Here is some FATAL");