<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0038)http://www.dingl.com/view.shtml?xh=485 -->
<HTML><HEAD><TITLE>Log4J 最佳实践之全能配置文件--DingL.com</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content="Log4J 日志 配置" name=keywords><LINK
href="Log4J 最佳实践之全能配置文件--DingL_com.files/front.jsp" type=text/css
rel=stylesheet>
<SCRIPT language=JavaScript
src="Log4J 最佳实践之全能配置文件--DingL_com.files/operator.js"></SCRIPT>
<META content="MSHTML 6.00.2800.1555" name=GENERATOR></HEAD>
<BODY text=#000000 bgColor=#ffffff leftMargin=0 topMargin=0>
<TABLE cellSpacing=0 cellPadding=0 width=770 align=center border=0>
<TBODY>
<TR>
<TD><IMG height=80 src="Log4J 最佳实践之全能配置文件--DingL_com.files/top.gif"
width=770></TD></TR>
<TR>
<TD height=1></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width=770 align=center bgColor=#000000
border=0>
<TBODY>
<TR>
<TD colSpan=3 height=1></TD></TR>
<TR>
<TD width=1 rowSpan=3></TD>
<TD background="Log4J 最佳实践之全能配置文件--DingL_com.files/nav_blue.gif"
height=25><DIV class=top align=center>
<TABLE class=top height=22 cellSpacing=0 cellPadding=0 align=right
border=0>
<TBODY>
<TR>
<TD width=50 height=17><A class=menu
href="http://www.dingl.com/">首页</A></TD>
<TD align=middle width=80 height=17><A class=menu
href="http://www.dingl.com/front.shtml?lmxh=7&method=index">JAVA</A>
</TD>
<TD align=middle width=80 height=17><A class=menu
href="http://www.dingl.com/front.shtml?lmxh=13&method=index">数据库</A>
</TD>
<TD align=middle width=80 height=17><A class=menu
href="http://www.dingl.com/front.shtml?lmxh=24&method=index">C/C++</A>
</TD>
<TD align=middle width=80 height=17><A class=menu
href="http://www.dingl.com/front.shtml?ejlmxh=11&method=list&sflb=1">网页技巧</A>
</TD>
<TD align=middle width=80 height=17><A class=menu
href="http://www.dingl.com/front.shtml?lmxh=22&method=index">开心一刻</A>
</TD>
<TD align=middle width=80 height=17><A class=menu
href="http://www.dingl.com/publish.jsp">本站作品</A> </TD>
<TD align=middle width=80 height=17><A class=menu
href="http://bbs.dingl.com/" target=_blank>DingL论坛</A>
</TD></TR></TBODY></TABLE></DIV></TD>
<TD width=1 rowSpan=3></TD></TR>
<TR>
<TD bgColor=#333333 height=1></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width=770 align=center bgColor=#efefef
border=0>
<TBODY>
<TR>
<TD height=2></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width=770 align=center border=0>
<TBODY>
<TR bgColor=#000000>
<TD width=1 rowSpan=3></TD>
<TD colSpan=2 height=1></TD>
<TD width=1 rowSpan=3></TD></TR>
<TR>
<TD class=topcss bgColor=#eeeeee colSpan=2 height=22>
<TABLE cellSpacing=0 cellPadding=0 width="100%">
<TBODY>
<TR>
<TD width=8></TD>
<TD noWrap><A class=menu href="http://www.dingl.com/">首页</A> > <A
class=menu
href="http://www.dingl.com/front.shtml?lmxh=7&method=index">JAVA</A>
> <A class=menu
href="http://www.dingl.com/front.shtml?ejlmxh=7&method=list&sflb=1">开源项目</A>
> Log4J 最佳实践之全能配置文件 </TD>
<FORM name=form1 action=search.shtml method=get>
<TD noWrap align=right width="20%">
<DIV valign="middle"><INPUT size=15 name=key> <INPUT class=botton type=submit value=搜索 name=Submit> </DIV></TD></FORM></TR></TBODY></TABLE></TD></TR>
<TR>
<TD bgColor=#000000 colSpan=2 height=1></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width=770 align=center border=0>
<TBODY>
<TR>
<TD width=2 bgColor=#787878 rowSpan=5></TD>
<TD bgColor=#999999 colSpan=5 height=1></TD>
<TD width=1 bgColor=#999999 rowSpan=5></TD></TR>
<TR>
<TD bgColor=#efefef colSpan=5 height=3></TD></TR>
<TR>
<TD bgColor=#999999 colSpan=5 height=1></TD></TR>
<TR>
<TD vAlign=top width=10 bgColor=#ccdcf6> </TD>
<TD width=1 bgColor=#999999></TD>
<TD vAlign=top>
<STYLE type=text/css>.big {
LINE-HEIGHT: 28px
}
.f24 {
FONT-SIZE: 24px
}
</STYLE>
<SCRIPT>
var titleName = "DingL.com -- " + "Log4J 最佳实践之全能配置文件 -- Java JSP J2EE 源码 -- DingL.com ";
//window.document.title = titleName;
</SCRIPT>
<TABLE height=200 cellSpacing=0 cellPadding=0 width="98%" align=center
border=0>
<TBODY>
<TR>
<TD height=6></TD></TR>
<TR>
<TD style="COLOR: #66998f" bgColor=#eeeeee height=20>
<TABLE width="100%"><!--
<tr align="center" width="100%"><th valign="middle" colspan=2><h2><B>Log4J 最佳实践之全能配置文件</B></h2></th></tr>
<tr height="1"><td colspan=2><hr size=1 bgcolor=#d9d9d9></td></tr> -->
<TBODY>
<TR>
<TH class=f24 colSpan=2><FONT color=#05006c>
<H3>Log4J 最佳实践之全能配置文件</H3></FONT></TH></TR>
<TR>
<TD colSpan=2 height=1>
<HR SIZE=1 bgcolor="#d9d9d9">
</TD></TR>
<TR>
<TD style="COLOR: #66998f" align=left
width="50%">2005-02-05</TD>
<TD style="COLOR: #66998f" align=right
width="50%">浏览次数:2928</TD></TR></TBODY></TABLE></TD></TR>
<TR>
<TD height=20></TD></TR>
<TR>
<TD vAlign=top height=200>
<TABLE cellSpacing=0 cellPadding=0 width="96%" align=center
border=0>
<TBODY>
<TR>
<TD class=big vAlign=top width=540>
<P>
<DIV>
<TABLE class=midbox cellSpacing=0 cellPadding=2 width="100%"
border=0>
<TBODY>
<TR>
<TD class=content align=right
width=60> 作者: </TD>
<TD class=content colSpan=2><A class=storybyline
href="http://www.cybercorlin.net/users.php?mode=profile&uid=4"><U>corlin</U></A></TD></TR>
<TR>
<TD class=content align=right
width=60> 日期: </TD>
<TD class=content colSpan=2>04-05-10 11:07</TD></TR>
<TR>
<TD class=content align=right
width=60> 点击数: </TD>
<TD class=content>5651 </TD>
<TD align=right> </TD></TR></TBODY></TABLE>
<TABLE class=fullbox cellSpacing=0 cellPadding=5 width="100%"
border=0>
<TBODY>
<TR>
<TD class=content colSpan=2><A
href="http://www.cybercorlin.net/index.php?topic=bestpractices"><IMG
title=最佳实践 alt=最佳实践
src="Log4J 最佳实践之全能配置文件--DingL_com.files/best.gif"
align=right
border=0></A>下面给出得Log4J配置文件实现了输出到控制台,文件,回滚文件,发送日志邮件,输出到数据库日志表,自定义标签等全套功能。<BR><BR>log4j.rootLogger=DEBUG,CONSOLE,A1,im<BR>#DEBUG,CONSOLE,FILE,ROLLING_FILE,MAIL,DATABASE<BR><BR>log4j.addivity.org.apache=true<BR><BR><BR>###################<BR>#
Console
Appender<BR>###################<BR>log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender<BR>log4j.