How to use log4j in the way/format I want?
===

I want to understand how log4j works.
I've read a lot of tutorials and all the answers from this site, but I still didn't get a concrete example which works.

I've tried this:

    import org.apache.log4j.*;
    
    public class Exercise {
    	private static Logger logger = Logger.getLogger(SimpleLogger.class);
    
    	public static void main(String args[]) {
    
    		BasicConfigurator.configure();
    
    		// ConsoleAppender myAppender = new ConsoleAppender(null, "System.out");
    		// myAppender.setLayout(new SimpleLayout());
    		// logger.addAppender(myAppender);
    
    		for (int i = 0; i < 5; i++) {
    			logger.info("You are here!");
    		}
    
    		logger.info("End of program");
    	}
    }

With this class:

    import org.apache.log4j.spi.LoggingEvent;
    
    public class SimpleLogger extends org.apache.log4j.Layout {
    
    	@Override
    	public void activateOptions() {
    
    	}
    
    	@Override
    	public String format(LoggingEvent event) {
    		return "log message = " + event.getMessage().toString() + "/n";
    	}
    
    	@Override
    	public boolean ignoresThrowable() {
    		return true;
    	}
    }

But my output is:

    0 [main] INFO SimpleLogger  - You are here!
    1 [main] INFO SimpleLogger  - You are here!
    1 [main] INFO SimpleLogger  - You are here!
    1 [main] INFO SimpleLogger  - You are here!
    1 [main] INFO SimpleLogger  - You are here!
    1 [main] INFO SimpleLogger  - End of program

I've tried also, with the code not commented but all I got is the output in double form or something.

Question:
How can I make the output (Console or File) be in the format that I want?
Do I need to modify an external file like (log4j.properties)?