/*
 * Copyright 2010, Red Hat, Inc. and individual contributors as indicated by the
 * @author tags. See the copyright.txt file in the distribution for a full
 * listing of individual contributors.
 * 
 * This is free software; you can redistribute it and/or modify it under the
 * terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 * 
 * This software is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with this software; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF
 * site: http://www.fsf.org.
 */
package org.zanata.log4j;

import org.apache.log4j.HTMLLayout;
import org.apache.log4j.spi.LoggingEvent;

/**
 * Extension of Log4J's HTML layout.
 *
 * @author Carlos Munoz <a href="mailto:camunoz@redhat.com">camunoz@redhat.com</a>
 */
public class ZanataHTMLLayout extends HTMLLayout
{
   @Override
   public String format(LoggingEvent event)
   {
      StringBuffer buffer = new StringBuffer();

      // add a row with the username
      buffer.append("<tr>");
      buffer.append("<td>");
      buffer.append("Username: ");
      buffer.append("</td>");
      buffer.append("<td colspan='5'>");
      buffer.append(event.getMDC("username"));
      buffer.append("</td>");
      buffer.append("</tr>");

      buffer.append( super.format(event) );
      return buffer.toString();
   }
}

@@ -1342,17 +1342,19 @@
 ngBu
-ff
+ild
 er bu
-ff
+ild
 er =
@@ -1366,18 +1366,19 @@
 StringBu
-ff
+ild
 er();%0A%0A 
@@ -1413,34 +1413,35 @@
 sername%0A      bu
-ff
+ild
 er.append(%22%3Ctr%3E%22
@@ -1443,34 +1443,35 @@
 %3Ctr%3E%22);%0A      bu
-ff
+ild
 er.append(%22%3Ctd%3E%22
@@ -1473,34 +1473,35 @@
 %3Ctd%3E%22);%0A      bu
-ff
+ild
 er.append(%22Usern
@@ -1509,34 +1509,35 @@
 me: %22);%0A      bu
-ff
+ild
 er.append(%22%3C/td%3E
@@ -1540,34 +1540,35 @@
 /td%3E%22);%0A      bu
-ff
+ild
 er.append(%22%3Ctd c
@@ -1582,34 +1582,35 @@
 '5'%3E%22);%0A      bu
-ff
+ild
 er.append(event.
@@ -1630,34 +1630,35 @@
 ame%22));%0A      bu
-ff
+ild
 er.append(%22%3C/td%3E
@@ -1661,34 +1661,35 @@
 /td%3E%22);%0A      bu
-ff
+ild
 er.append(%22%3C/tr%3E
@@ -1701,18 +1701,19 @@
       bu
-ff
+ild
 er.appen
@@ -1714,17 +1714,16 @@
 .append(
- 
 super.fo
@@ -1733,17 +1733,16 @@
 t(event)
- 
 );%0A     
@@ -1755,10 +1755,11 @@
 n bu
-ff
+ild
 er.t

Change to StringBuilder in Html email layout implementation.