You need to have a log4j.xml somewhere in your class path with information telling it where to log, how to log etc. Alternatively you can set all this programmatically in your code, but it's much nicer to have the flexibility in your implementation.
My log4j.xml looks like: