一. 本地项目: 初始化log4j的日志配置,指定到src目录下(建议用2)
        //1. 本地项目-属性文件配置
        PropertyConfigurator.configure("src/config/log4j.properties");
        //2. 本地项目-xml文件配置
        DOMConfigurator.configure("src/config/log4j.xml");
        //3. 本地项目-默认配置
        BasicConfigurator.configure();
        
二. web项目初始化: 初始化log4j的日志配置,在web.xml中
    <context-param>
        <param-name>log4jConfigLocation</param-name>
        <param-value>classpath:config/log4j.xml</param-value>
    </context-param>



来自为知笔记(Wiz)


附件列表

     

    posted on 2017-04-04 17:11  duenboa  阅读(5854)  评论(0编辑  收藏  举报