You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@logging.apache.org by venkatesh <ve...@lasonindia.com> on 2007/02/10 13:35:45 UTC

Using PatternLayout and HTMLlayout....

Hi Users,
  Is it possible to use both layouts (pattern and html) at the same time since i reqd to output the logs to a html file with my customized patterns..

Let me know the way to use like this.

Regards,
Venkatesh P.

Re: Using PatternLayout and HTMLlayout....

Posted by Curt Arnold <ca...@apache.org>.
On Feb 10, 2007, at 6:35 AM, venkatesh wrote:

> Hi Users,
>   Is it possible to use both layouts (pattern and html) at the same  
> time since i reqd to output the logs to a html file with my  
> customized patterns..
>
> Let me know the way to use like this.
>
> Regards,
> Venkatesh P.
>


general@logging.apache.org is intended for discussions that affect  
all the logging services projects which is generally project  
governance related issues.  The proper mailing list for your question  
is log4j-user@logging.apache.org.

I'll take a stab at your question, but please do not respond on this  
list to say thanks or to continue to ask questions.  If you have more  
questions, please start a new thread on log4j-user.

An FileAppender uses a single Layout to convert a logging event into  
a set of characters.  It does not support multiple layouts and it is  
not obvious how it could in a way that makes general sense.

Likely the best solution to your problem is to define a pattern  
layout with a header that emits the "<html><head>...</ 
head><body>..." , a pattern that produces the HTML for each event  
(likely a <td>) and then a footer like "</table></html>".  If you are  
configuring this using an XML file, remember that you will have to  
represent "<" as "&lt;" and ">" as "&gt;".