Download Sample Project from here.
Steps to use log4j :
1.) Download log4j dependency.(included in sample project)
2.) Download log4j.properties (included in sample project)
Create Java Program:
package com.asj;
import org.apache.log4j.Logger;
public class LoggerDemo {
/**
* @created by Aman
*/
public static Logger logger = Logger.getLogger(LoggerDemo.class);
public static void main(String[] args) {
logger.info("Hello!! you are in info log");
logger.warn("Hello!! you are in warn log");
logger.error("Hello!! you are in error log");
logger.debug("Hello!! you are in debug log");
}
}
No comments:
Post a Comment