log4j.rootLogger=error, stdout
### direct log messages to stdout ###
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} [%5p] %c{1}:%L - %m%n
log4j.logger.com.witbridge.payroll=debug
//包名称,输出到控制台
测试:
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public class TestlOG {
private static Log logger=LogFactory.getLog(TestlOG.class);
public static void main(String args[]){
logger.debug("hello");
}
}