Log4j is a simple and flexible logging framework. Logging equips the developer with detailed context for application failures. With log4j it is possible to enable logging at runtime without modifying the application.
Two most common configuration options are in practice industry wide i.e. using xml configuration and using properties configuration.
For detailed explanation you can refer : http://www.tutorialspoint.com/log4j/index.htm