Hi,
I am really grateful for the quick response. Finally I had to override the 
HtmlLayout, because that was the shortest solution this time. In case I have 
some time after Christmas, I would heartily help you with fixing this problem. 
Anyway I really appreciate and admire the effort you make for this handy tool. 
Best regards and wishes,
Dori 

Adrienn Dora Gal
Senior Programmer - Touch Clarity Ltd. 

[EMAIL PROTECTED]

 

Adam House, 1 Fitzroy Square, LONDON W1T 5HE UK

DD: +44 (0) 20 7380 4425 | MOB: +44 (0)7901-847156 | SB: +44 (0)20 7380 4400  | 
Website: www.touchclarity.com

 

Any information transmitted in this e-mail or its attachments is intended only 
for the person or entity to which it is addressed and may contain confidential 
and/or privileged material. Any review, retransmission, dissemination or other 
use of, or taking of any action in reliance upon, this information by persons 
or entities other than the intended recipient is prohibited. If you received 
this in error, please contact the sender and delete all relevant material from 
all computers.


-----Original Message-----
From: Ceki G�lc� [mailto:[EMAIL PROTECTED] 
Sent: 29 November 2004 20:30
To: Log4J Developers List
Subject: Re: HtmlLayout bad formatting, ignoresThrowable not called


Dora,

By design, there is no way in log4j to force an Appender to ignore 
exceptions. If its layout handles exceptions on its own, then an Appender 
will let its layout print them. If its layout does *not* handle exceptions, 
then an Appender will print exceptions itself.

In log4j 1.3, pattern based layouts such as o.a.l.html.HTMLLayout check if 
a converter in their pattern chain handles exceptions. It it does, then the 
layout will delegate exception printing to the pattern chain, otherwise it 
will output the exception itself.

Your best bet is to convince o.a.l.html.HTMLLayout that one of its pattern 
converters is handling exceptions while in reality it does not. I *just* 
modified o.a.l.html.HTMLLayout to skip printing exceptions if one of its 
converters handles them. To benefit from this fix, you have to either build 
log4j from CVS or wait for alpha4.

You can't currently have o.a.l.html.HTMLLayout recognize your exception 
(non)-handling converter using a configuration file. You have to do it 
programmatically. If I have the time until alpha4, I'll fix the code so 
that you'll be able to add your custom conversion rule with a config file.

See o.a.l.PatternLayout#addConversionRule method on how to add new rules 
programmatically.

HTH,

At 08:40 PM 11/29/2004, Dora Gal wrote:
>Hi All,
>
>Currently the task assigned to me is to provide html log file for our 
>clients. We would like to hide the hide the throwables, and runtime 
>configuration is a requirement this time. My solution is:
>
>             HTMLLayout layout = new HTMLLayout() {
>                 // hiding exceptions from client logs
>                 public boolean ignoresThrowable() {
>                     return true;
>                 }
>
>             };
>             layout.setTitle("Site " + siteID + " synchronisation log");
>             clientLoggerAppender = new FileAppender(layout, logFileName, 
> false);
>
>With jakarta-log4j-1.2.7 and logging-log4j-1.2.9 the generated html is 
>malformed, and contains the throwable (find attachment, please).
>
>The HtmlLayout#format(LoggingEvent event) method seems to ignores to call 
>the ignoresThrowable() method in the corresponding if clause:
>
>public
>   String format(LoggingEvent event) {
>
>             .............
>
>     String[] s = event.getThrowableStrRep();
>     if(s != null) {
>       sbuf.append("<tr><td bgcolor=\"#993300\" style=\"color:White; 
> font-size : xx-small;\" colspan=\"6\">");
>       appendThrowableAsHTML(s, sbuf);
>       sbuf.append("</td></tr>" + Layout.LINE_SEP);
>     }
>
>     return sbuf.toString();
>   }
>
>
>I tried to download logging-log4j-1.3alpha-3 in the hope that the problem 
>has already been corrected. For my biggest surprise I could not even find 
>the HtmlLayout class neither in the src folder nor within the API docs. 
>However, the Layout class has been extended with a 
>setIgnoresThrowables(boolean ignoresThrowable) method J. Then I found two 
>reported bugs that are quite similar to my symptoms:
>
><http://issues.apache.org/bugzilla/show_bug.cgi?id=7948>7948 Layout & 
>Subclasses: getFooter never called
><http://issues.apache.org/bugzilla/show_bug.cgi?id=21794>21794 HtmlLayout 
>not closing table, body, and html tags on close
>
>The second bug has already been reported for V1.3alpha. I attached the 
>generated html file..
>Could somebody help me with this problem?
>
>Thanks a lot in advance,
>Dori
>
>
>
>
>Adrienn Dora Gal
>Senior Programmer - Touch Clarity Ltd.
>
><mailto:[EMAIL PROTECTED]>[EMAIL PROTECTED]
>
>
>
>Adam House, 1 Fitzroy Square, LONDON W1T 5HE UK
>
>DD: +44 (0) 20 7380 4425 | MOB: +44 (0)7901-847156 | SB: +44 (0)20 7380 
>4400  | Website: <http://www.touchclarity.com/>www.touchclarity.com
>
>
>
>Any information transmitted in this e-mail or its attachments is intended 
>only for the person or entity to which it is addressed and may contain 
>confidential and/or privileged material. Any review, retransmission, 
>dissemination or other use of, or taking of any action in reliance upon, 
>this information by persons or entities other than the intended recipient 
>is prohibited. If you received this in error, please contact the sender 
>and delete all relevant material from all computers.
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]

-- 
Ceki G�lc�

  The complete log4j manual:  http://qos.ch/eclm
  Professional log4j support: http://qos.ch/log4jSupport  



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


=======================================================================
              Scanned for virus infection by Messagelabs
=======================================================================

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to