logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nicko Cadell" <ni...@neoworks.com>
Subject RE: html output
Date Tue, 13 Dec 2005 17:48:19 GMT
You can leverage the existing (Rolling)FileAppender infrastructure by
writing a Layout object that renders HTML. There is an example appender
in the log4net source code log4net.Layout.SimpleLayout (in the download
incubating-log4net-1.2.9-beta\src\Layout\SimpleLayout.cs). It should be
simple to extend this to output HTML formatted text. You don't need to
modify log4net you can reference your custom layout in your own assembly
from the log4net configuration file.

The biggest problem with logging to HTML is that HTML is not suitable to
streaming, essentially it does not support re-opening the file and
appending additional entries, this is due to the
<html><body></body></html> wrapping tags. Either you will need to
use
the RollingFileAppender in RollingMode.Once where the files are never
re-opened and appended to, or if you don't care about valid HTML you
could probably just set the layout's Header text to '<html><body>' and
then not bother closing those tags at the end of the file. (depends on
how strict your browser is).

Cheers,
Nicko

> -----Original Message-----
> From: Brian Gustavsen [mailto:bg@adwiza.com] 
> Sent: 13 December 2005 09:07
> To: log4net-user@logging.apache.org
> Subject: html output
> 
> are there any html logfile appender or is it possible to 
> write it my self ?
>  
> Best Regards/Med venlig hilsen
>  
> Brian Gustavsen
>  
> ________________________________
> 
> 
> Adwiza ApS
> 
> Drejergangen 3 B
> 
> DK-2690 Karlslunde
> 
> Denmark
> 
>  
> 
> E-mail:        bg@adwiza.com <mailto:bg@adwiza.com> 
> 
> Web-site:    www.adwiza.com 
> <blocked::blocked::blocked::http://www.adwiza.com/> 
> 
>  
> 
> Office:  +45 70 22 85 50
> 
> Fax:     +45 70 22 85 51
> 
>  
> 
> Register as user at our Web-site: Click here! 
> <blocked::blocked::blocked::http://www.adwiza.com/user/user_cr
> eate.asp> 
> 
> Sign up for our newsletter:          Click here! 
> <blocked::blocked::blocked::http://www.adwiza.com/news/newslet
> ter.htm> 
> 
> ________________________________
> 
> ** The information enclosed in this electronic mail message, 
> including 
> 
> ** any attachment, is the confidential property of Adwiza ApS.
> 
> ** All rights reserved under copyright and applicable laws
> 
>  
>  
> For help and support please use support@adwiza.com
>  
> 

Mime
View raw message