logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1483418 - in /logging/log4j/log4j2/trunk: core/src/main/java/org/apache/logging/log4j/core/layout/HTMLLayout.java core/src/test/java/org/apache/logging/log4j/core/layout/HTMLLayoutTest.java src/changes/changes.xml
Date Thu, 16 May 2013 15:50:35 GMT
Author: ggregory
Date: Thu May 16 15:50:35 2013
New Revision: 1483418

URL: http://svn.apache.org/r1483418
Log:
[LOG4J2-258] HTML layout does not output meta element for charset.

Modified:
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/layout/HTMLLayout.java
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/layout/HTMLLayoutTest.java
    logging/log4j/log4j2/trunk/src/changes/changes.xml

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/layout/HTMLLayout.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/layout/HTMLLayout.java?rev=1483418&r1=1483417&r2=1483418&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/layout/HTMLLayout.java
(original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/layout/HTMLLayout.java
Thu May 16 15:50:35 2013
@@ -258,6 +258,7 @@ public final class HTMLLayout extends Ab
         sbuf.append(Constants.LINE_SEP);
         sbuf.append("<html>").append(Constants.LINE_SEP);
         sbuf.append("<head>").append(Constants.LINE_SEP);
+        sbuf.append("<meta charset=\"").append(getCharset()).append("\"/>").append(Constants.LINE_SEP);
         sbuf.append("<title>").append(title).append("</title>").append(Constants.LINE_SEP);
         sbuf.append("<style type=\"text/css\">").append(Constants.LINE_SEP);
         sbuf.append("<!--").append(Constants.LINE_SEP);
@@ -317,7 +318,7 @@ public final class HTMLLayout extends Ab
                                           @PluginAttr("charset") final String charsetName,
                                           @PluginAttr("fontSize") String fontSize,
                                           @PluginAttr("fontName") String font) {
-        final Charset charset = Charsets.getSupportedCharset(charsetName);
+        final Charset charset = Charsets.getSupportedCharset(charsetName, Charsets.UTF_8);
         if (font == null) {
             font = "arial,sans-serif";
         }

Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/layout/HTMLLayoutTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/layout/HTMLLayoutTest.java?rev=1483418&r1=1483417&r2=1483418&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/layout/HTMLLayoutTest.java
(original)
+++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/layout/HTMLLayoutTest.java
Thu May 16 15:50:35 2013
@@ -96,10 +96,12 @@ public class HTMLLayoutTest {
 
         final List<String> list = appender.getMessages();
         assertTrue("Incorrect number of lines. Require at least 85 " + list.size(), list.size()
> 85);
-        assertTrue("Incorrect header", list.get(3).equals("<title>Log4J Log Messages</title>"));
+        final String string = list.get(3);
+        assertTrue("Incorrect header: " + string, string.equals("<meta charset=\"UTF-8\"/>"));
+        assertTrue("Incorrect title", list.get(4).equals("<title>Log4J Log Messages</title>"));
         assertTrue("Incorrect footer", list.get(list.size() - 1).equals("</body></html>"));
-        assertTrue("Incorrect multiline", list.get(49).equals(multiLine));
-        assertTrue("Incorrect body", list.get(70).equals(body));
+        assertTrue("Incorrect multiline", list.get(50).equals(multiLine));
+        assertTrue("Incorrect body", list.get(71).equals(body));
 
     }
 }

Modified: logging/log4j/log4j2/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/src/changes/changes.xml?rev=1483418&r1=1483417&r2=1483418&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/src/changes/changes.xml (original)
+++ logging/log4j/log4j2/trunk/src/changes/changes.xml Thu May 16 15:50:35 2013
@@ -22,6 +22,9 @@
   </properties>
   <body>
     <release version="2.0-beta7" date="2013-??-??" description="Bug fixes and enhancements">
+      <action issue="LOG4J2-258" dev="ggregory" type="fix">
+        HTML layout does not output meta element for charset.
+      </action>
       <action issue="LOG4J2-257" dev="ggregory" type="fix">
         XML layout ignores charset for the XML processing intruction's encoding attribute.
       </action>



Mime
View raw message