log4j-usage.html

最详细的Log4j使用教程 – 码农网 var duoshuoQuery = {"short_name":"codeceo","sso":{"login":"http:\/\/www.codeceo.com\/wp-login.php?action=duoshuo_login","logout":"http:\/\/www.codeceo.com\/wp-login.php?action=logout&_wpnonce=f0e551c546"},"theme":"default","stylePatch":"wordpress\/"}; duoshuoQuery.sso.login += '&redirect_to=' + encodeURIComponent(window.location.href); duoshuoQuery.sso.logout += '&redirect_to=' + encodeURIComponent(window.location.href);
(adsbygoogle = window.adsbygoogle || []).push({});

最详细的Log4j使用教程

        </header>

日志是应用软件中不可缺少的部分,Apache的开源项目log4j是一个功能强大的日志组件,提供方便的日志记录。在apache网站:jakarta.apache.org/log4j 可以免费下载到Log4j最新版本的软件包。

一、入门实例

1.新建一个JAva工程,导入包log4j-1.2.17.jar,整个工程最终目录如下

2、src同级创建并设置log4j.properties

 ### 设置###
log4j.rootLogger = debug,stdout,D,E





### 输出信息到控制抬 ### 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 = [%-5p] %d{yyyy-MM-dd HH:mm:ss,SSS} method:%l%n%m%n ### 输出DEBUG 级别以上的日志到=E://logs/error.log ### log4j.appender.D = org.apache.log4j.DailyRollingFileAppender log4j.appender.D.File = E://logs/log.log log4j.appender.D.Append = true log4j.appender.D.Threshold = DEBUG log4j.appender.D.layout = org.apache.log4j.PatternLayout log4j.appender.D.layout.ConversionPattern = %-d{yyyy-MM-dd HH:mm:ss} [ %t:%r ] - [ %p ] %m%n ### 输出ERROR 级别以上的日志到=E://logs/error.log ### log4j.appender.E = org.apache.log4j.DailyRollingFileAppender log4j.appender.E.File =E://logs/error.log log4j.appender.E.Append = true log4j.appender.E.Threshold = ERROR log4j.appender.E.layout = org.apache.log4j.PatternLayout log4j.appender.E.layout.ConversionPattern = %-d{yyyy-MM-dd HH:mm:ss} [ %t:%r ] - [ %p ] %m%n

3、设置日志内容

package com.mucfc;
import org.apache.log4j.Logger;
/**
 *@author linbingwen
 *@2015年5月18日9:14:21
 */
public class Test {
    private static Logger logger = Logger.getLogger(Test.class);  

    /** 
     * @param args 
     */  
    public static void main(String[] args) {  
        // System.out.println("This is println message.");  

        // 记录debug级别的信息  
        logger.debug("This is debug message.");  
        // 记录info级别的信息  
        logger.info("This is info message.");  
        // 记录error级别的信息  
        logger.error("This is error message.");  
    }  

}

4、输出结果

(1)首先是控制台的信息

(2)再来看输出的文件

内容如下,发现已按照要求输出到对应的文档中去了。

二、Log4j基本使用方法

Log4j由三个重要的组件构成:日志信息的优先级,日志信息的输出目的地,日志信息的输出格式。日志信息的优先级从高到低有ERROR、WARN、 INFO、DEBUG,分别用来指定这条日志信息的重要程度;日志信息的输出目的地指定了日志将打印到控制台还是文件中;而输出格式则控制了日志信息的显 示内容。

2.1、定义配置文件

其实您也可以完全不使用配置文件,而是在代码中配置Log4j环境。但是,使用配置文件将使您的应用程序更加灵活。Log4j支持两种配置文件格式,一种是XML格式的文件,一种是Java特性文件(键=值)。下面我们介绍使用Java特性文件做为配置文件的方法:
1.配置根Logger,其语法为:

log4j.rootLogger = [ level ] , appenderName, appenderName, …

其中,level 是日志记录的优先级,分为OFF、FATAL、ERROR、WARN、INFO、DEBUG、ALL或者您定义的级别。Log4j建议只使用四个级别,优 先级从高到低分别是ERROR、WARN、INFO、DEBUG。通过在这里定义的级别,您可以控制到应用程序中相应级别的日志信息的开关。比如在这里定 义了INFO级别,则应用程序中所有DEBUG级别的日志信息将不被打印出来。 appenderName就是指B日志信息输出到哪个地方。您可以同时指定多个输出目的地。

2.配置日志信息输出目的地Appender,其语法为:

log4j.appender.appenderName = fully.qualified.name.of.appender.class  
log4j.appender.appenderName.option1 = value1  
…  
log4j.appender.appenderName.option = valueN

其中,Log4j提供的appender有以下几种:

org.apache.log4j.ConsoleAppender(控制台),  
org.apache.log4j.FileAppender(文件),  
org.apache.log4j.DailyRollingFileAppender(每天产生一个日志文件),  
org.apache.log4j.RollingFileAppender(文件大小到达指定尺寸的时候产生一个新的文件),  
org.apache.log4j.WriterAppender(将日志信息以流格式发送到任意指定的地方)

3.配置日志信息的格式(布局),其语法为:

log4j.appender.appenderName.layout = fully.qualified.name.of.layout.class  
log4j.appender.appenderName.layout.option1 = value1  
…  
log4j.appender.appenderName.layout.option = valueN

其中,Log4j提供的layout有以e几种:

org.apache.log4j.HTMLLayout(以HTML表格形式布局),  
org.apache.log4j.PatternLayout(可以灵活地指定布局模式),  
org.apache.log4j.SimpleLayout(包含日志信息的级别和信息字符串),  
org.apache.log4j.TTCCLayout(包含日志产生的时间、线程、类别等等信息)

Log4J采用类似C语言中的printf函数的打印格式格式化日志信息,打印参数如下: %m 输出代码中指定的消息

%p 输出优先级,即DEBUG,INFO,WARN,ERROR,FATAL  
%r 输出自应用启动到输出该log信息耗费的毫秒数  
%c 输出所属的类目,通常就是所在类的全名  
%t 输出产生该日志事件的线程名  
%n 输出一个回车换行符,Windows平台为“rn”,Unix平台为“n”  
%d 输出日志时间点的日期或时间,默认格式为ISO8601,也可以在其后指定格式,比如:%d{yyy MMM dd HH:mm:ss,SSS},输出类似:2002年10月18日 22:10:28,921  
%l 输出日志事件的发生位置,包括类目名、发生的线程,以及在代码中的行数。举例:Testlog4.main(TestLog4.java:10)

2.2、在代码中使用Log4j

1.得到记录器

使用Log4j,第一步就是获取日志记录器,这个记录器将负责控制日志信息。其语法为:

public static Logger getLogger( String name)

通过指定的名字获得记录器,如果必要的话,则为这个名字创建一个新的记录器。Name一般取本类的名字,比如:

static Logger logger = Logger.getLogger ( ServerWithLog4j.class.getName () )

2.读取配置文件

当获得了日志记录器之后,第二步将配置Log4j环境,其语法为:

BasicConfigurator.configure (): 自动快速地使用缺省Log4j环境。  
PropertyConfigurator.configure ( String configFilename) :读取使用Java的特性文件编写的配置文件。  
DOMConfigurator.configure ( String filename ) :读取XML形式的配置文件。

3.插入记录信息(格式化日志信息)

当上两个必要步骤执行完毕,您就可以轻松地使用不同优先级别的日志记录语句插入到您想记录日志的任何地方,其语法如下:

Logger.debug ( Object message ) ;  
Logger.info ( Object message ) ;  
Logger.warn ( Object message ) ;  
Logger.error ( Object message ) ;

2.3、日志级别

每个Logger都被了一个日志级别(log level),用来控制日志信息的输出。日志级别从高到低分为:
A:off 最高等级,用于关闭所有日志记录。
B:fatal 指出每个严重的错误事件将会导致应用程序的退出。
C:error 指出虽然发生错误事件,但仍然不影响系统的继续运行。
D:warm 表明会出现潜在的错误情形。
E:info 一般和在粗粒度级别上,强调应用程序的运行全程。
F:debug 一般用于细粒度级别上,对调试应用程序非常有帮助。
G:all 最低等级,用于打开所有日志记录。

上面这些级别是定义在org.apache.log4j.Level类中。Log4j只建议使用4个级别,优先级从高到低分别是error,warn,info和debug。通过使用日志级别,可以控制应用程序中相应级别日志信息的输出。例如,如果使用b了info级别,则应用程序中所有低于info级别的日志信息(如debug)将不会被打印出来。

三、Web项目中使用Log4j实例

上面代码描述了Log4j的简单应用,其实使用Log4j也就是这样简单方便。当然除了上面的配置方法,还有其它,比如做一个J2EE应用,在J2EE应用使用Log4j,必须先在启动服务时加载Log4j的配置文件进行初始化,可以在web.xml中进行。

1、web应用的log4j使用基本上都采用:新建一个servlet,这个servlet在init函数中为log4j执行配置。一般就是读入配置文件。所以需要在web.xml中为这个servlet配置,同时设定load-on-startup为1。

2、这个servlet配置log4j就是读出配置文件,然后调用configure函数。这里有两个问题:一、需要知道文件在哪里;二、需要正确的文件类型

3、配置文件位置在web.xml中配置一个param即可,路径一般是相对于web的root目录

4、文件类型一般有两种,一个是Java的property文件,另一种是xml文件

配置文件的大致内容:log4j可以指定输出的log级别的最低等级,以及log的输出配置格式,每个log可以指定多个输出方式

(1)创建Web工程,整个工程最后目录如下

(2)web.xml配置如下:

<?xml version="1.0" encoding="UTF-8"?>  
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
    xmlns="http://java.sun.com/xml/ns/javaee"  
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"  
    id="WebApp_ID" version="3.0">  
    <display-name>LogLearning</display-name>  

    <servlet>  
        <servlet-name>Log4JTestServlet</servlet-name>  
        <servlet-class>com.mucfc.Log4JTestServlet</servlet-class>  
    </servlet>  

    <!--用来启动 log4jConfigLocation的servlet -->  
    <servlet>  
        <servlet-name>Log4JInitServlet</servlet-name>  
        <servlet-class>com.mucfc.Log4JInitServlet</servlet-class>  
        <init-param>  
            <param-name>log4j-properties-location</param-name>  
            <param-value>/WEB-INF/classes/log4j.properties</param-value>  
        </init-param>  
        <load-on-startup>1</load-on-startup>  
    </servlet>  

    <servlet-mapping>  
        <servlet-name>Log4JTestServlet</servlet-name>  
        <url-pattern>/test</url-pattern>  
    </servlet-mapping>  

</web-app>

(3)配置文件log4j.properties

 ### set log levels ###  
log4j.rootLogger = debug,stdout,D,E  

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 = [%-5p] %d{yyyy-MM-dd HH:mm:ss,SSS} method:%l%n%m%n  

log4j.appender.D = org.apache.log4j.DailyRollingFileAppender  
log4j.appender.D.File = F://logs/log.log  
log4j.appender.D.Append = true  
log4j.appender.D.Threshold = DEBUG   
log4j.appender.D.layout = org.apache.log4j.PatternLayout  
log4j.appender.D.layout.ConversionPattern = %-d{yyyy-MM-dd HH:mm:ss}  [ %t:%r ] - [ %p ]  %m%n  

log4j.appender.E = org.apache.log4j.DailyRollingFileAppender  
log4j.appender.E.File =F://logs/error.log   
log4j.appender.E.Append = true  
log4j.appender.E.Threshold = ERROR   
log4j.appender.E.layout = org.apache.log4j.PatternLayout  
log4j.appender.E.layout.ConversionPattern = %-d{yyyy-MM-dd HH:mm:ss}  [ %t:%r ] - [ %p ]  %m%n

(4)web容器一来就初始化的servlet

Log4JInitServlet.java

package com.mucfc;  

import java.io.File;  
import java.io.IOException;  

import javax.servlet.ServletConfig;  
import javax.servlet.ServletContext;  
import javax.servlet.ServletException;  
import javax.servlet.annotation.WebServlet;  
import javax.servlet.http.HttpServlet;  
import javax.servlet.http.HttpServletRequest;  
import javax.servlet.http.HttpServletResponse;  

import org.apache.log4j.BasicConfigurator;  
import org.apache.log4j.PropertyConfigurator;  

/** 
 * Servlet implementation class Log4JInitServlet 
 */  
@WebServlet("/Log4JInitServlet")  
public class Log4JInitServlet extends HttpServlet {  
    private static final long serialVersionUID = 1L;  

    /** 
     * @see HttpServlet#HttpServlet() 
     */  
    public Log4JInitServlet() {  
        super();  
        // TODO Auto-generated constructor stub  
    }  

    /** 
     * @see Servlet#init(ServletConfig) 
     */  
    public void init(ServletConfig config) throws ServletException {  
        System.out.println("Log4JInitServlet 正在初始化 log4j日志设置信息");  
        String log4jLocation = config.getInitParameter("log4j-properties-location");  

        ServletContext sc = config.getServletContext();  

        if (log4jLocation == null) {  
            System.err.println("*** 没有 log4j-properties-location 初始化的文件, 所以使用 BasicConfigurator初始化");  
            BasicConfigurator.configure();  
        } else {  
            String webAppPath = sc.getRealPath("/");  
            String log4jProp = webAppPath + log4jLocation;  
            File yoMamaYesThisSaysYoMama = new File(log4jProp);  
            if (yoMamaYesThisSaysYoMama.exists()) {  
                System.out.println("使用: " + log4jProp+"初始化日志设置信息");  
                PropertyConfigurator.configure(log4jProp);  
            } else {  
                System.err.println("*** " + log4jProp + " 文件没有找到, 所以使用 BasicConfigurator初始化");  
                BasicConfigurator.configure();  
            }  
        }  
        super.init(config);  
    }  

    /** 
     * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) 
     */  
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {  
        // TODO Auto-generated method stub  
    }  

    /** 
     * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) 
     */  
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {  
        // TODO Auto-generated method stub  
    }  

}

调用日志Log4JTestServlet,java

package com.mucfc;  

import java.io.IOException;  

import javax.servlet.ServletConfig;  
import javax.servlet.ServletException;  
import javax.servlet.annotation.WebServlet;  
import javax.servlet.http.HttpServlet;  
import javax.servlet.http.HttpServletRequest;  
import javax.servlet.http.HttpServletResponse;  

import org.apache.log4j.Logger;  

/** 
 * Servlet implementation class Log4JTestServlet 
 */  
@WebServlet("/Log4JTestServlet")  
public class Log4JTestServlet extends HttpServlet {  
    private static final long serialVersionUID = 1L;  
    private static Logger logger = Logger.getLogger(Log4JTestServlet.class);    

    /** 
     * @see HttpServlet#HttpServlet() 
     */  
    public Log4JTestServlet() {  
        super();  
        // TODO Auto-generated constructor stub  
    }  

    /** 
     * @see Servlet#init(ServletConfig) 
     */  
    public void init(ServletConfig config) throws ServletException {  
        // TODO Auto-generated method stub  
    }  

    /** 
     * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) 
     */  
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {  
        // 记录debug级别的信息    
        logger.debug("This is debug message.");    
        // 记录info级别的信息    
        logger.info("This is info message.");    
        // 记录error级别的信息    
        logger.error("This is error message.");    
    }  

    /** 
     * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) 
     */  
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {  
        doGet(request,response);  
    }  

}

接下来就是运行了,来看看结果:

输出结果:

四、Spring中使用Log4j

这里要实现web项目中利用Spring来使用Log4j

(1)接上面的工程,然后再导入Spring的包

(2)web.xml增加

<!-- 设置根目录 -->  
   <context-param>    
       <param-name>webAppRootKey</param-name>    
       <param-value>webapp.root</param-value>    
   </context-param>    

   <context-param>  
    <param-name>log4jConfigLocation</param-name>  
    <param-value>/WEB-INF/classes/log4j.properties</param-value>  
</context-param>  
<!-- 3000表示 开一条watchdog线程每60秒扫描一下配置文件的变化;这样便于日志存放位置的改变 -->  
<context-param>    
        <param-name>log4jRefreshInterval</param-name>    
        <param-value>3000</param-value>    
   </context-param>   
<listener>  
    <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>  
</listener>

整个内容如下:

<?xml version="1.0" encoding="UTF-8"?>  
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
    xmlns="http://java.sun.com/xml/ns/javaee"  
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"  
    id="WebApp_ID" version="3.0">  
    <display-name>LogLearning</display-name>  

    <servlet>  
        <servlet-name>Log4JTestServlet</servlet-name>  
        <servlet-class>com.mucfc.Log4JTestServlet</servlet-class>  
    </servlet>  

    <!--用来启动 log4jConfigLocation的servlet -->  
<!--     <servlet>  
        <servlet-name>Log4JInitServlet</servlet-name>  
        <servlet-class>com.mucfc.Log4JInitServlet</servlet-class>  
        <init-param>  
            <param-name>log4j-properties-location</param-name>  
            <param-value>/WEB-INF/classes/log4j.properties</param-value>  
        </init-param>  
        <load-on-startup>1</load-on-startup>  
    </servlet>-->  

    <servlet-mapping>  
        <servlet-name>Log4JTestServlet</servlet-name>  
        <url-pattern>/test</url-pattern>  
    </servlet-mapping>   

        <!-- Spring 容器加载 -->  
    <listener>  
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>  
    </listener>  
    <context-param>  
        <param-name>contextConfigLocation</param-name>  
        <param-value>classpath:applicationContext.xml</param-value>  
    </context-param>   

    <!-- 设置根目录 -->  
    <context-param>    
        <param-name>webAppRootKey</param-name>    
        <param-value>webapp.root</param-value>    
    </context-param>    

    <context-param>  
        <param-name>log4jConfigLocation</param-name>  
        <param-value>/WEB-INF/classes/log4j.properties</param-value>  
    </context-param>  
    <!-- 3000表示 开一条watchdog线程每60秒扫描一下配置文件的变化;这样便于日志存放位置的改变 -->  
    <context-param>    
         <param-name>log4jRefreshInterval</param-name>    
         <param-value>3000</param-value>    
    </context-param>   
    <listener>  
        <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>  
    </listener>   

</web-app>

这里Log4JInitServlet.java就相当于没用到了。

(2)applicationContext.xml

没有内容:

<?xml version="1.0" encoding="UTF-8"?>  
<beans xmlns="http://www.springframework.org/schema/beans"  
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"  
    xmlns:aop="http://www.springframework.org/schema/aop"  
    xsi:schemaLocation="    

http://www.springframework.org/schema/beans


http://www.springframework.org/schema/beans/spring-beans-3.2.xsd


http://www.springframework.org/schema/aop


http://www.springframework.org/schema/aop/spring-aop-3.2.xsd


http://www.springframework.org/schema/context

           http://www.springframework.org/schema/context/spring-context-3.2.xsd">  
</beans>

(3)这样日志就跟随Spring窗口启动而启动了

程序一运行,就会自动把日志打印

log.log

error.log为空,因为它只打印error级别以上的信息

浏览器输入http://localhost:8080/LogLearning2/test

然后打开文件

(adsbygoogle = window.adsbygoogle || []).push({});


var cpro_id="u2554801"; (window["cproStyleApi"] = window["cproStyleApi"] || {})[cpro_id]={at:"3",rsi0:"300",rsi1:"250",pat:"17",tn:"baiduCustNativeAD",rss1:"#FFFFFF",conBW:"1",adp:"1",ptt:"0",titFF:"%E5%BE%AE%E8%BD%AF%E9%9B%85%E9%BB%91",titFS:"14",rss2:"#000000",titSU:"0"}
var cpro_id="u2405524"; (window["cproStyleApi"] = window["cproStyleApi"] || {})[cpro_id]={at:"3",rsi0:"300",rsi1:"250",pat:"17",tn:"baiduCustNativeAD",rss1:"#FFFFFF",conBW:"1",adp:"1",ptt:"0",titFF:"%E5%BE%AE%E8%BD%AF%E9%9B%85%E9%BB%91",titFS:"",rss2:"#000000",titSU:"0"}
        </div>

相关文章

在文章中找不到问题答案?您还可以

前往问答社区提问



            <div class="article-tags">继续浏览有关<a href="http://www.codeceo.com/article/tag/java" rel="tag">JAVA开发</a><a href="http://www.codeceo.com/article/tag/log4j" rel="tag">Log4j</a>的文章</div>
        </footer>


    </div>





    <a name="comments"></a>
if (typeof DUOSHUO !== 'undefined') DUOSHUO.EmbedThread('.ds-thread');
  1. 非常实用,感谢,为入门的人提供学习案例!

            </article><!-- #comment-## -->
        </li>
        <li class="comment odd alt thread-odd thread-alt depth-1" id="li-comment-4307">
            <article id="comment-4307" class="comment">
                <footer class="comment-meta">
                    <cite class="comment-author vcard">
                        <span class="fn">祖泽</span> on <a rel="nofollow" href="http://www.codeceo.com/article/log4j-usage.html#comment-4307"><time pubdate datetime="2015-08-08T22:49:25+08:00">2015 年 8 月 8 日 at 下午 10:49</time></a> <span class="says">said:</span>                    </cite><!-- .comment-author .vcard -->
                </footer>
    
                <div class="comment-content"><p> <img src="http://img.t.sinajs.cn/t35/style/images/common/face/ext/normal/d0/z2_org.gif" alt="[赞]" title="[赞]" class="ds-smiley" /> </p>
    

        </article><!-- #comment-## -->
    </li>
    <li class="comment even thread-even depth-1" id="li-comment-4984">
        <article id="comment-4984" class="comment">
            <footer class="comment-meta">
                <cite class="comment-author vcard">
                    <span class="fn">Ly</span> on <a rel="nofollow" href="http://www.codeceo.com/article/log4j-usage.html#comment-4984"><time pubdate datetime="2015-09-11T17:27:28+08:00">2015 年 9 月 11 日 at 下午 5:27</time></a> <span class="says">said:</span>                    </cite><!-- .comment-author .vcard -->
            </footer>

            <div class="comment-content"><p>赞一个</p>

        </article><!-- #comment-## -->
    </li>
    <li class="comment odd alt thread-odd thread-alt depth-1" id="li-comment-5131">
        <article id="comment-5131" class="comment">
            <footer class="comment-meta">
                <cite class="comment-author vcard">
                    <span class="fn">log4j新手</span> on <a rel="nofollow" href="http://www.codeceo.com/article/log4j-usage.html#comment-5131"><time pubdate datetime="2015-09-18T17:36:13+08:00">2015 年 9 月 18 日 at 下午 5:36</time></a> <span class="says">said:</span>                   </cite><!-- .comment-author .vcard -->
            </footer>

            <div class="comment-content"><p>叼叼叼</p>

        </article><!-- #comment-## -->
    </li>
    <li class="duoshuo even thread-even depth-1" id="li-comment-5912">
        <article id="comment-5912" class="comment">
            <footer class="comment-meta">
                <cite class="comment-author vcard">
                    <span class="fn">log4j</span> on <a rel="nofollow" href="http://www.codeceo.com/article/log4j-usage.html#comment-5912"><time pubdate datetime="2015-10-30T17:14:40+08:00">2015 年 10 月 30 日 at 下午 5:14</time></a> <span class="says">said:</span>                    </cite><!-- .comment-author .vcard -->
            </footer>

            <div class="comment-content"><p>[给力]</p>

        </article><!-- #comment-## -->
    </li>
    <li class="comment odd alt thread-odd thread-alt depth-1" id="li-comment-6150">
        <article id="comment-6150" class="comment">
            <footer class="comment-meta">
                <cite class="comment-author vcard">
                    <span class="fn"><a href='http://t.qq.com/hao1935825316' rel='external nofollow' class='url'>耳东-</a></span> on <a rel="nofollow" href="http://www.codeceo.com/article/log4j-usage.html#comment-6150"><time pubdate datetime="2015-11-11T14:41:47+08:00">2015 年 11 月 11 日 at 下午 2:41</time></a> <span class="says">said:</span>                  </cite><!-- .comment-author .vcard -->
            </footer>

            <div class="comment-content"><p>最后能生成文件 但是没有内容 是怎么回事?</p>

        </article><!-- #comment-## -->
    <ul class='children'>
    <li class="comment even depth-2" id="li-comment-6424">
        <article id="comment-6424" class="comment">
            <footer class="comment-meta">
                <cite class="comment-author vcard">
                    <span class="fn">Earl</span> on <a rel="nofollow" href="http://www.codeceo.com/article/log4j-usage.html#comment-6424"><time pubdate datetime="2015-11-25T15:47:26+08:00">2015 年 11 月 25 日 at 下午 3:47</time></a> <span class="says">said:</span>                 </cite><!-- .comment-author .vcard -->
            </footer>

            <div class="comment-content"><p>将Log4jConfigListener配置在ContextLoaderListener的前面试试</p>

        </article><!-- #comment-## -->
    </li>
    <li class="comment odd alt depth-2" id="li-comment-9745">
        <article id="comment-9745" class="comment">
            <footer class="comment-meta">
                <cite class="comment-author vcard">
                    <span class="fn"><a href='http://t.qq.com/njw128' rel='external nofollow' class='url'>进伟</a></span> on <a rel="nofollow" href="http://www.codeceo.com/article/log4j-usage.html#comment-9745"><time pubdate datetime="2016-04-19T11:28:13+08:00">2016 年 4 月 19 日 at 上午 11:28</time></a> <span class="says">said:</span>                  </cite><!-- .comment-author .vcard -->
            </footer>

            <div class="comment-content"><p>log4j.appender.E.layout.ConversionPattern = %-d{yyyy-MM-dd HH:mm:ss}  [ %t:%r ] &#8211; [ %p ] 后边加%m</p>

        </article><!-- #comment-## -->
    </li>
    <li class="comment even depth-2" id="li-comment-11199">
        <article id="comment-11199" class="comment">
            <footer class="comment-meta">
                <cite class="comment-author vcard">
                    <span class="fn">hi</span> on <a rel="nofollow" href="http://www.codeceo.com/article/log4j-usage.html#comment-11199"><time pubdate datetime="2016-08-10T16:46:15+08:00">2016 年 8 月 10 日 at 下午 4:46</time></a> <span class="says">said:</span>                   </cite><!-- .comment-author .vcard -->
            </footer>

            <div class="comment-content"><p>路径问题</p>

        </article><!-- #comment-## -->
    </li>



  •             <div class="comment-content"><p>1111</p>
    

            </article><!-- #comment-## -->
        </li>
        <li class="comment even thread-odd thread-alt depth-1" id="li-comment-7640">
            <article id="comment-7640" class="comment">
                <footer class="comment-meta">
                    <cite class="comment-author vcard">
                        <span class="fn">cc</span> on <a rel="nofollow" href="http://www.codeceo.com/article/log4j-usage.html#comment-7640"><time pubdate datetime="2016-01-13T17:20:34+08:00">2016 年 1 月 13 日 at 下午 5:20</time></a> <span class="says">said:</span>                    </cite><!-- .comment-author .vcard -->
                </footer>
    
                <div class="comment-content"><p>很赞,写的很全面~</p>
    

            </article><!-- #comment-## -->
        </li>
        <li class="comment odd alt thread-even depth-1" id="li-comment-8088">
            <article id="comment-8088" class="comment">
                <footer class="comment-meta">
                    <cite class="comment-author vcard">
                        <span class="fn">89</span> on <a rel="nofollow" href="http://www.codeceo.com/article/log4j-usage.html#comment-8088"><time pubdate datetime="2016-01-31T22:36:01+08:00">2016 年 1 月 31 日 at 下午 10:36</time></a> <span class="says">said:</span>                   </cite><!-- .comment-author .vcard -->
                </footer>
    
                <div class="comment-content"><p>so  good</p>
    

            </article><!-- #comment-## -->
        </li>
        <li class="comment even thread-odd thread-alt depth-1" id="li-comment-8942">
            <article id="comment-8942" class="comment">
                <footer class="comment-meta">
                    <cite class="comment-author vcard">
                        <span class="fn"><a href='http://w3cschool.codecloud.net/' rel='external nofollow' class='url'>FuckC</a></span> on <a rel="nofollow" href="http://www.codeceo.com/article/log4j-usage.html#comment-8942"><time pubdate datetime="2016-03-14T11:54:49+08:00">2016 年 3 月 14 日 at 上午 11:54</time></a> <span class="says">said:</span>                  </cite><!-- .comment-author .vcard -->
                </footer>
    
                <div class="comment-content"><p>详细! [给力]</p>
    

            </article><!-- #comment-## -->
        </li>
        <li class="comment odd alt thread-even depth-1" id="li-comment-9144">
            <article id="comment-9144" class="comment">
                <footer class="comment-meta">
                    <cite class="comment-author vcard">
                        <span class="fn"><a href='http://t.qq.com/LW451671431' rel='external nofollow' class='url'>落伍</a></span> on <a rel="nofollow" href="http://www.codeceo.com/article/log4j-usage.html#comment-9144"><time pubdate datetime="2016-03-21T10:54:03+08:00">2016 年 3 月 21 日 at 上午 10:54</time></a> <span class="says">said:</span>                 </cite><!-- .comment-author .vcard -->
                </footer>
    
                <div class="comment-content"><p>很好,很详细</p>
    

            </article><!-- #comment-## -->
        </li>
        <li class="comment even thread-odd thread-alt depth-1" id="li-comment-9178">
            <article id="comment-9178" class="comment">
                <footer class="comment-meta">
                    <cite class="comment-author vcard">
                        <span class="fn"><a href='http://t.qq.com/lidaoquan001' rel='external nofollow' class='url'>李道泉</a></span> on <a rel="nofollow" href="http://www.codeceo.com/article/log4j-usage.html#comment-9178"><time pubdate datetime="2016-03-22T17:20:43+08:00">2016 年 3 月 22 日 at 下午 5:20</time></a> <span class="says">said:</span>                    </cite><!-- .comment-author .vcard -->
                </footer>
    
                <div class="comment-content"><p>web的根本跑步起来,eclipseMARS tomcat8</p>
    

            </article><!-- #comment-## -->
        </li>
        <li class="comment odd alt thread-even depth-1" id="li-comment-9199">
            <article id="comment-9199" class="comment">
                <footer class="comment-meta">
                    <cite class="comment-author vcard">
                        <span class="fn">good</span> on <a rel="nofollow" href="http://www.codeceo.com/article/log4j-usage.html#comment-9199"><time pubdate datetime="2016-03-23T23:11:53+08:00">2016 年 3 月 23 日 at 下午 11:11</time></a> <span class="says">said:</span>                 </cite><!-- .comment-author .vcard -->
                </footer>
    
                <div class="comment-content"><p>[赞]</p>
    

            </article><!-- #comment-## -->
        </li>
        <li class="comment even thread-odd thread-alt depth-1" id="li-comment-9256">
            <article id="comment-9256" class="comment">
                <footer class="comment-meta">
                    <cite class="comment-author vcard">
                        <span class="fn"><a href='http://t.qq.com/supperwangqiang' rel='external nofollow' class='url'>王强</a></span> on <a rel="nofollow" href="http://www.codeceo.com/article/log4j-usage.html#comment-9256"><time pubdate datetime="2016-03-28T10:28:50+08:00">2016 年 3 月 28 日 at 上午 10:28</time></a> <span class="says">said:</span>                 </cite><!-- .comment-author .vcard -->
                </footer>
    
                <div class="comment-content"><p>支持一下</p>
    

            </article><!-- #comment-## -->
        </li>
        <li class="comment odd alt thread-even depth-1" id="li-comment-9914">
            <article id="comment-9914" class="comment">
                <footer class="comment-meta">
                    <cite class="comment-author vcard">
                        <span class="fn"><a href='http://t.qq.com/me504917396' rel='external nofollow' class='url'>吕晓宁</a></span> on <a rel="nofollow" href="http://www.codeceo.com/article/log4j-usage.html#comment-9914"><time pubdate datetime="2016-04-21T15:23:38+08:00">2016 年 4 月 21 日 at 下午 3:23</time></a> <span class="says">said:</span>                 </cite><!-- .comment-author .vcard -->
                </footer>
    
                <div class="comment-content"><p>好文章呀</p>
    

            </article><!-- #comment-## -->
        </li>
        <li class="comment even thread-odd thread-alt depth-1" id="li-comment-9968">
            <article id="comment-9968" class="comment">
                <footer class="comment-meta">
                    <cite class="comment-author vcard">
                        <span class="fn">爆炒鸡蛋仔</span> on <a rel="nofollow" href="http://www.codeceo.com/article/log4j-usage.html#comment-9968"><time pubdate datetime="2016-04-22T23:30:35+08:00">2016 年 4 月 22 日 at 下午 11:30</time></a> <span class="says">said:</span>                    </cite><!-- .comment-author .vcard -->
                </footer>
    
                <div class="comment-content"><p>谢谢楼主分享啊~~</p>
    

            </article><!-- #comment-## -->
        </li>
        <li class="comment odd alt thread-even depth-1" id="li-comment-10045">
            <article id="comment-10045" class="comment">
                <footer class="comment-meta">
                    <cite class="comment-author vcard">
                        <span class="fn">小辉哥</span> on <a rel="nofollow" href="http://www.codeceo.com/article/log4j-usage.html#comment-10045"><time pubdate datetime="2016-04-26T13:32:30+08:00">2016 年 4 月 26 日 at 下午 1:32</time></a> <span class="says">said:</span>                  </cite><!-- .comment-author .vcard -->
                </footer>
    
                <div class="comment-content"><p>真的写的饿很好。</p>
    

            </article><!-- #comment-## -->
        </li>
        <li class="comment even thread-odd thread-alt depth-1" id="li-comment-10144">
            <article id="comment-10144" class="comment">
                <footer class="comment-meta">
                    <cite class="comment-author vcard">
                        <span class="fn">收费多少个</span> on <a rel="nofollow" href="http://www.codeceo.com/article/log4j-usage.html#comment-10144"><time pubdate datetime="2016-05-03T22:59:26+08:00">2016 年 5 月 3 日 at 下午 10:59</time></a> <span class="says">said:</span>                    </cite><!-- .comment-author .vcard -->
                </footer>
    
                <div class="comment-content"><p>对对对</p>
    

            </article><!-- #comment-## -->
        </li>
        <li class="comment odd alt thread-even depth-1" id="li-comment-10216">
            <article id="comment-10216" class="comment">
                <footer class="comment-meta">
                    <cite class="comment-author vcard">
                        <span class="fn"><a href='http://t.qq.com/K745112388' rel='external nofollow' class='url'>skipper</a></span> on <a rel="nofollow" href="http://www.codeceo.com/article/log4j-usage.html#comment-10216"><time pubdate datetime="2016-05-09T10:58:03+08:00">2016 年 5 月 9 日 at 上午 10:58</time></a> <span class="says">said:</span>                 </cite><!-- .comment-author .vcard -->
                </footer>
    
                <div class="comment-content"><p>必须赞一个</p>
    

            </article><!-- #comment-## -->
        </li>
        <li class="comment even thread-odd thread-alt depth-1" id="li-comment-10243">
            <article id="comment-10243" class="comment">
                <footer class="comment-meta">
                    <cite class="comment-author vcard">
                        <span class="fn">蛮好</span> on <a rel="nofollow" href="http://www.codeceo.com/article/log4j-usage.html#comment-10243"><time pubdate datetime="2016-05-12T09:34:04+08:00">2016 年 5 月 12 日 at 上午 9:34</time></a> <span class="says">said:</span>                   </cite><!-- .comment-author .vcard -->
                </footer>
    
                <div class="comment-content"><p>log4j.appender.D.layout.ConversionPattern = %-d{yyyy-MM-dd HH:mm:ss}  [ %t:%r ] &#8211; [ %p ]  %m%n   这个输出内容是空的,,我改成其他项目配置好的   %d [%c:%L] [%t] &#8211; %m%n   这个看不懂</p>
    

            </article><!-- #comment-## -->
        </li>
        <li class="comment odd alt thread-even depth-1" id="li-comment-10309">
            <article id="comment-10309" class="comment">
                <footer class="comment-meta">
                    <cite class="comment-author vcard">
                        <span class="fn">猿</span> on <a rel="nofollow" href="http://www.codeceo.com/article/log4j-usage.html#comment-10309"><time pubdate datetime="2016-05-19T09:36:49+08:00">2016 年 5 月 19 日 at 上午 9:36</time></a> <span class="says">said:</span>                    </cite><!-- .comment-author .vcard -->
                </footer>
    
                <div class="comment-content"><p>不错</p>
    

            </article><!-- #comment-## -->
        </li>
        <li class="comment even thread-odd thread-alt depth-1" id="li-comment-10400">
            <article id="comment-10400" class="comment">
                <footer class="comment-meta">
                    <cite class="comment-author vcard">
                        <span class="fn">kk</span> on <a rel="nofollow" href="http://www.codeceo.com/article/log4j-usage.html#comment-10400"><time pubdate datetime="2016-05-27T14:17:14+08:00">2016 年 5 月 27 日 at 下午 2:17</time></a> <span class="says">said:</span>                   </cite><!-- .comment-author .vcard -->
                </footer>
    
                <div class="comment-content"><p>k</p>
    

            </article><!-- #comment-## -->
        </li>
        <li class="comment odd alt thread-even depth-1" id="li-comment-10470">
            <article id="comment-10470" class="comment">
                <footer class="comment-meta">
                    <cite class="comment-author vcard">
                        <span class="fn"><a href='http://weibo.com/2525232750' rel='external nofollow' class='url'>zhangtmit</a></span> on <a rel="nofollow" href="http://www.codeceo.com/article/log4j-usage.html#comment-10470"><time pubdate datetime="2016-06-02T16:55:44+08:00">2016 年 6 月 2 日 at 下午 4:55</time></a> <span class="says">said:</span>                   </cite><!-- .comment-author .vcard -->
                </footer>
    
                <div class="comment-content"><p>log4j</p>
    

            </article><!-- #comment-## -->
        </li>
        <li class="comment even thread-odd thread-alt depth-1" id="li-comment-10712">
            <article id="comment-10712" class="comment">
                <footer class="comment-meta">
                    <cite class="comment-author vcard">
                        <span class="fn"><a href='http://t.qq.com/ganggejixiang' rel='external nofollow' class='url'>龙腾</a></span> on <a rel="nofollow" href="http://www.codeceo.com/article/log4j-usage.html#comment-10712"><time pubdate datetime="2016-07-06T10:17:30+08:00">2016 年 7 月 6 日 at 上午 10:17</time></a> <span class="says">said:</span>                   </cite><!-- .comment-author .vcard -->
                </footer>
    
                <div class="comment-content"><p> <img src="http://img.t.sinajs.cn/t35/style/images/common/face/ext/normal/d8/good_org.gif" alt="[good]" title="[good]" class="ds-smiley" /> </p>
    

            </article><!-- #comment-## -->
        </li>
        <li class="comment odd alt thread-even depth-1" id="li-comment-10879">
            <article id="comment-10879" class="comment">
                <footer class="comment-meta">
                    <cite class="comment-author vcard">
                        <span class="fn"><a href='http://t.qq.com/zzxiaoming0601' rel='external nofollow' class='url'>小明</a></span> on <a rel="nofollow" href="http://www.codeceo.com/article/log4j-usage.html#comment-10879"><time pubdate datetime="2016-07-22T09:03:45+08:00">2016 年 7 月 22 日 at 上午 9:03</time></a> <span class="says">said:</span>                  </cite><!-- .comment-author .vcard -->
                </footer>
    
                <div class="comment-content"><p>最后那里输出都是空,怎么解决</p>
    

            </article><!-- #comment-## -->
        </li>
        <li class="comment even thread-odd thread-alt depth-1" id="li-comment-11072">
            <article id="comment-11072" class="comment">
                <footer class="comment-meta">
                    <cite class="comment-author vcard">
                        <span class="fn">rain</span> on <a rel="nofollow" href="http://www.codeceo.com/article/log4j-usage.html#comment-11072"><time pubdate datetime="2016-08-01T12:01:37+08:00">2016 年 8 月 1 日 at 下午 12:01</time></a> <span class="says">said:</span>                 </cite><!-- .comment-author .vcard -->
                </footer>
    
                <div class="comment-content"><p> <img src="http://img.t.sinajs.cn/t35/style/images/common/face/ext/normal/d8/good_org.gif" alt="[good]" title="[good]" class="ds-smiley" /> </p>
    

            </article><!-- #comment-## -->
        </li>
        <li class="comment odd alt thread-even depth-1" id="li-comment-11099">
            <article id="comment-11099" class="comment">
                <footer class="comment-meta">
                    <cite class="comment-author vcard">
                        <span class="fn">路人甲</span> on <a rel="nofollow" href="http://www.codeceo.com/article/log4j-usage.html#comment-11099"><time pubdate datetime="2016-08-03T13:45:49+08:00">2016 年 8 月 3 日 at 下午 1:45</time></a> <span class="says">said:</span>                   </cite><!-- .comment-author .vcard -->
                </footer>
    
                <div class="comment-content"><p>顶一个</p>
    

            </article><!-- #comment-## -->
        </li>
        <li class="comment even thread-odd thread-alt depth-1" id="li-comment-11119">
            <article id="comment-11119" class="comment">
                <footer class="comment-meta">
                    <cite class="comment-author vcard">
                        <span class="fn"><a href='http://t.qq.com/scs659313' rel='external nofollow' class='url'>侍昌盛</a></span> on <a rel="nofollow" href="http://www.codeceo.com/article/log4j-usage.html#comment-11119"><time pubdate datetime="2016-08-04T17:10:16+08:00">2016 年 8 月 4 日 at 下午 5:10</time></a> <span class="says">said:</span>                   </cite><!-- .comment-author .vcard -->
                </footer>
    
                <div class="comment-content"><p> <img src="http://img.t.sinajs.cn/t35/style/images/common/face/ext/normal/d8/good_org.gif" alt="[good]" title="[good]" class="ds-smiley" /> </p>
    

            </article><!-- #comment-## -->
        </li>
        <li class="comment odd alt thread-even depth-1" id="li-comment-11133">
            <article id="comment-11133" class="comment">
                <footer class="comment-meta">
                    <cite class="comment-author vcard">
                        <span class="fn">panda</span> on <a rel="nofollow" href="http://www.codeceo.com/article/log4j-usage.html#comment-11133"><time pubdate datetime="2016-08-05T22:50:32+08:00">2016 年 8 月 5 日 at 下午 10:50</time></a> <span class="says">said:</span>                    </cite><!-- .comment-author .vcard -->
                </footer>
    
                <div class="comment-content"><p>非常不错。http://www.rm5u.com</p>
    

            </article><!-- #comment-## -->
        </li>
        <li class="comment even thread-odd thread-alt depth-1" id="li-comment-11148">
            <article id="comment-11148" class="comment">
                <footer class="comment-meta">
                    <cite class="comment-author vcard">
                        <span class="fn"><a href='http://t.qq.com/dengni---1314' rel='external nofollow' class='url'>蒋鑫俊</a></span> on <a rel="nofollow" href="http://www.codeceo.com/article/log4j-usage.html#comment-11148"><time pubdate datetime="2016-08-07T23:49:43+08:00">2016 年 8 月 7 日 at 下午 11:49</time></a> <span class="says">said:</span>                  </cite><!-- .comment-author .vcard -->
                </footer>
    
                <div class="comment-content"><p>很不错的。写的很好</p>
    

            </article><!-- #comment-## -->
        </li>
            </ol>
    
    
    </div>
    
            </div>
    

    (adsbygoogle = window.adsbygoogle || []).push({});

    var cpro_id="u2191321"; (window["cproStyleApi"] = window["cproStyleApi"] || {})[cpro_id]={at:"3",rsi0:"300",rsi1:"250",pat:"17",tn:"baiduCustNativeAD",rss1:"#FFFFFF",conBW:"1",adp:"1",ptt:"0",titFF:"%E5%BE%AE%E8%BD%AF%E9%9B%85%E9%BB%91",titFS:"14",rss2:"#000000",titSU:"0"}
    var cpro_id="u2509144"; (window["cproStyleApi"] = window["cproStyleApi"] || {})[cpro_id]={at:"3",rsi0:"300",rsi1:"250",pat:"17",tn:"baiduCustNativeAD",rss1:"#FFFFFF",conBW:"1",adp:"1",ptt:"0",titFF:"%E5%BE%AE%E8%BD%AF%E9%9B%85%E9%BB%91",titFS:"14",rss2:"#000000",titSU:"0"}
        </div></aside><div style="position:absolute;right:0px;">
    <div class="widget widget_d_hotpost hot_cat">
        <h3 class="widget_tit">热门栏目订阅</h3>
        <ul class="cat_list">
            <li>
                <img src="http://static.codeceo.com/images/2016/03/java-logo-4.jpg" alt="java" class="cat_img" />
                <h4 class="cat_title"><a href="http://www.codeceo.com/article/category/develop/java" target="_blank">Java</a></h4>
                <span class="cat_link"><a href="http://www.codeceo.com/article/category/develop/java/feed" target="_blank">RSS</a></span>
                <span class="cat_link"><a href="http://weibo.com/u/3206249732" target="_blank">微博</a></span>
            </li>
            <li>
                <img src="http://static.codeceo.com/images/2016/03/programmer-logo-4.jpg" alt="程序员" class="cat_img" />
                <h4 class="cat_title"><a href="http://www.codeceo.com/article/category/programmer" target="_blank">程序员</a></h4>
                <span class="cat_link"><a href="http://www.codeceo.com/article/category/programmer/feed" target="_blank">RSS</a></span>
                <span class="cat_link"><a href="http://weibo.com/u/2832482174" target="_blank">微博</a></span>
            </li>
            <li>
                <img src="http://static.codeceo.com/images/2016/03/android-logo-4.png" alt="Android" class="cat_img" />
                <h4 class="cat_title"><a href="http://www.codeceo.com/article/category/develop/android" target="_blank">Android</a></h4>
                <span class="cat_link"><a href="http://www.codeceo.com/article/category/develop/android/feed" target="_blank">RSS</a></span>
            </li>
            <li>
                <img src="http://static.codeceo.com/images/2016/03/php-logo-4.png" alt="PHP" class="cat_img" />
                <h4 class="cat_title"><a href="http://www.codeceo.com/article/tag/php" target="_blank">PHP</a></h4>
                <span class="cat_link"><a href="http://www.codeceo.com/article/tag/php/feed" target="_blank">RSS</a></span>
            </li>
            <li>
                <img src="http://static.codeceo.com/images/2016/03/javascript-logo-4.png" alt="JavaScript" class="cat_img" />
                <h4 class="cat_title"><a href="http://www.codeceo.com/article/tag/javascript" target="_blank">JavaScript</a></h4>
                <span class="cat_link"><a href="http://www.codeceo.com/article/tag/javascript/feed" target="_blank">RSS</a></span>
            </li>
            <li>
                <img src="http://static.codeceo.com/images/2016/03/linux-logo-4.png" alt="Linux" class="cat_img" />
                <h4 class="cat_title"><a href="http://www.codeceo.com/article/tag/linux" target="_blank">Linux</a></h4>
                <span class="cat_link"><a href="http://www.codeceo.com/article/tag/linux/feed" target="_blank">RSS</a></span>
            </li>
        </ul>
    </div>
    
    <div style="clear:both;width:160px"></div>
    
    <div style="width:160px;height:600px">
        <script type="text/javascript">
        var cpro_id="u2518649";
        (window["cproStyleApi"] = window["cproStyleApi"] || {})[cpro_id]={at:"3",rsi0:"160",rsi1:"600",pat:"6",tn:"baiduCustNativeAD",rss1:"#FFFFFF",conBW:"1",adp:"1",ptt:"0",titFF:"%E5%BE%AE%E8%BD%AF%E9%9B%85%E9%BB%91",titFS:"14",rss2:"#000000",titSU:"0",ptbg:"90",piw:"0",pih:"0",ptp:"0"}
        </script>
        <script src="http://cpro.baidustatic.com/cpro/ui/c.js" type="text/javascript"></script>
    </div>
    
    <div style="margin-top:20px" id="fixedNav">
        <p style="text-align:center">
        <b>关注我们的微博</b>
        <div style="width:156px;overflow:hidden;border:#2a7cb9 solid 2px;margin-top:10px;margin-bottom:20px">
        <iframe width="100%" height="80" class="share_self"  frameborder="0" scrolling="no" src="http://widget.weibo.com/weiboshow/index.php?language=&width=0&height=80&fansRow=2&ptype=1&speed=0&skin=1&isTitle=0&noborder=0&isWeibo=0&isFans=0&uid=2832482174&verifier=d71718ca&dpc=1"></iframe></div>
        </p>
        <p style="text-align:center">
        <a style="display: block;width: 140px;background: #2a7cb9;font-size: 18px;color: #fff;line-height: 35px;padding: 10px;text-align:center;" href="http://www.codeceo.com/article/2016-codeceo-post-plan.html?utm_source=left_bar" target="_blank">付费投稿计划<br />点击查看详情</a>
        </p>
    </div>
    

    var relatedPostHTML = jQuery("#related-post-content"); jQuery("#related_post_bar").html(relatedPostHTML.html()); jQuery("#related-post-content").remove(); ScrollFloatPanel("related_post_bar","related_scroll"); jQuery("#article-entry").find('pre').each(function (i, block) { hljs.highlightBlock(block); }); try{ var elScript = document.createElement("script"); elScript.setAttribute("language", "javascript"); elScript.setAttribute("src", "http://www.codeceo.com/wp-counter.php?post_id=" + escape(strBatchView)); document.getElementsByTagName("body")[0].appendChild(elScript); } catch(e){};


    window._bd_share_config = { common : { bdSnsKey:{"tsina":"1527345946"}, bdUrl : 'http://www.codeceo.com/article/log4j-usage.html' }, share : [{ "bdSize" : 16 }] } with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?cdnversion='+~(-new Date()/36e5)]; ScrollFloatPanel("fixedNav","nav_scroll");
    var _hmt = _hmt || []; (function() { var hm = document.createElement("script"); hm.src = "//hm.baidu.com/hm.js?af429ff7a5d8173130dceafabcc90a92"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })();

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值