Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Design Pattern & UML  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 log4j的htmllayout会把bean和servlet的输出信息区分?
worldcreatxr





发贴: 149
积分: 0
于 2004-07-08 17:39 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
log4j的htmllayout会把bean和servlet的输出信息区分?

log4j的配置:
log4j.rootLogger=DEBUG, stdout, html
log4j.appender.html=org.apache.log4j.DailyRollingFileAppender
log4j.appender.html.DatePattern='.'yyyy-MM-dd
log4j.appender.html.File=log/debug.log.html
log4j.appender.html.layout=org.apache.log4j.HTMLLayout

输出:请保存以下的html代码到文件看一看
=======================================

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Log4J Log Messages</title>
<style type="text/css">
<!--
body, table {font-family: arial,sans-serif; font-size: x-small;}
th {background: #336699; color: #FFFFFF; text-align: left;}
-->
</style>
</head>
<body bgcolor="#FFFFFF" topmargin="6" leftmargin="6">
<hr size="1" noshade>
Log session start time Thu Jul 08 17:40:45 CST 2004<br>
<br>
<table cellspacing="0" cellpadding="4" border="1" bordercolor="#224466" width="100%">
<tr>
<th>Time</th>
<th>Thread</th>
<th>Level</th>
<th>Category</th>
<th>Message</th>
</tr>

<tr>
<td>0</td>
<td title="main thread">main</td>
<td title="Level">INFO</td>
<td title="creatxr.demos.simple.bean.HelloWorld category">creatxr.demos.simple.bean.HelloWorld</td>
<td title="Message">Hello World Bean</td>
</tr>

<tr>
<td>15</td>
<td title="main thread">main</td>
<td title="Level"><font color="#339933">DEBUG</font></td>
<td title="creatxr.demos.simple.bean.AllJUnitTests.HelloWorldTest category">creatxr.demos.simple.bean.AllJUnitTests.HelloWorldTest</td>
<td title="Message">HelloWorld.print() pass</td>
</tr>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Log4J Log Messages</title>
<style type="text/css">
<!--
body, table {font-family: arial,sans-serif; font-size: x-small;}
th {background: #336699; color: #FFFFFF; text-align: left;}
-->
</style>
</head>
<body bgcolor="#FFFFFF" topmargin="6" leftmargin="6">
<hr size="1" noshade>
Log session start time Thu Jul 08 17:40:46 CST 2004<br>
<br>
<table cellspacing="0" cellpadding="4" border="1" bordercolor="#224466" width="100%">
<tr>
<th>Time</th>
<th>Thread</th>
<th>Level</th>
<th>Category</th>
<th>Message</th>
</tr>

<tr>
<td>0</td>
<td title="main thread">main</td>
<td title="Level"><font color="#339933">DEBUG</font></td>
<td title="creatxr.demos.simple.servlet.AllJUnitTests.HelloWorldTest category">creatxr.demos.simple.servlet.AllJUnitTests.HelloWorldTest</td>
<td title="Message"><html><head><title> Servlet Example </title></head><body>
Hello World Servlet
</body></html>
</td>
</tr>

<tr>
<td>16</td>
<td title="main thread">main</td>
<td title="Level"><font color="#993300"><strong>WARN</strong></font></td>
<td title="creatxr.demos.simple.servlet.HelloWorld category">creatxr.demos.simple.servlet.HelloWorld</td>
<td title="Message">127.0.0.1 root</td>
</tr>

<tr>
<td>32</td>
<td title="main thread">main</td>
<td title="Level"><font color="#339933">DEBUG</font></td>
<td title="creatxr.demos.simple.servlet.AllJUnitTests.HelloWorldTest category">creatxr.demos.simple.servlet.AllJUnitTests.HelloWorldTest</td>
<td title="Message"><html><head><title> Servlet Example </title></head><body>
username <> userpass
</body></html>
</td>
</tr>



我是世界的缔造者!

flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923