log4j.properties配置文件# This is the configuring for logging displayed in the Application Server
log4j.rootCategory=INFO, stdout,logfile#stdout configure
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern= %d %p [%c] - <%m>%n#logfile configure
log4j.appender.logfile=org.apache.log4j.DailyRollingFileAppender
log4j.appender.logfile.File=../logs/SpringSide.log
log4j.appender.logfile.layout=org.apache.log4j.PatternLayout
log4j.appender.logfile.layout.ConversionPattern= %d %p [%c] - <%m>%n# Control logging for other open source packages
# Changing the log level to DEBUG when debug
log4j.logger.org.springframework=WARN
# Changing the log level to DEBUG will display SQL Hibernate generated
log4j.logger.org.hibernate=WARN
log4j.logger.org.hibernate.SQL=ERROR
log4j.logger.org.hibernate.cache=ERROR
log4j.logger.net.sf.ehcache=ERROR
log4j.logger.org.apache.commons.validator.ValidatorResources=ERRORjava类public class SpringDemo { 
    public static void main(String[] args) { 
        Resource rs = new ClassPathResource("example/ch2/beans-config.xml"); 
        log.info("哈哈,解析完了 ");
        BeanFactory factory = new XmlBeanFactory(rs); 
        log.info("资源获得完毕");
        System.out.println("start");
        HelloBean hello = (HelloBean) factory.getBean("helloBean"); 
        System.out.println("end");
        System.out.println(hello.getHelloWord()); 
        log.info("测试:"+hello.getHelloWord());
    } 
    private static final Log log = LogFactory.getLog(SpringDemo.class);