ceki 02/04/25 14:18:15 Modified: docs HISTORY src/java/org/apache/log4j FileAppender.java HTMLLayout.java src/java/org/apache/log4j/xml XMLLayout.java src/xdocs contactUs.xml Removed: src/java/org/apache/log4j StressCategory.java Log: Fixed bug 7550 in XMLLayout. Revision Changes Path 1.92 +4 -0 jakarta-log4j/docs/HISTORY Index: HISTORY =================================================================== RCS file: /home/cvs/jakarta-log4j/docs/HISTORY,v retrieving revision 1.91 retrieving revision 1.92 diff -u -r1.91 -r1.92 --- HISTORY 17 Apr 2002 21:52:25 -0000 1.91 +++ HISTORY 25 Apr 2002 21:18:14 -0000 1.92 @@ -9,6 +9,10 @@ - Release of version 1.2 + - In XMLLayout, Fixed bug #7550 by escaping the method attribute. The + XMLLayout also outputs each item of a stack trace in a separate + line. [*] + (rc1) - The ANT build script was modified to use jar files specified in 1.34 +5 -3 jakarta-log4j/src/java/org/apache/log4j/FileAppender.java Index: FileAppender.java =================================================================== RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/FileAppender.java,v retrieving revision 1.33 retrieving revision 1.34 diff -u -r1.33 -r1.34 --- FileAppender.java 24 Apr 2002 01:16:14 -0000 1.33 +++ FileAppender.java 25 Apr 2002 21:18:15 -0000 1.34 @@ -243,8 +243,6 @@ this.bufferSize = bufferSize; } - - /** <p>Sets and <i>opens</i> the file where the log output will go. The specified file must be writable. @@ -252,6 +250,10 @@ <p>If there was already an opened file, then the previous file is closed first. + <p><b>Do not use this method directly. To configure a FileAppender + or one of its subclasses, set its properties one by one and then + call activateOptions.</b> + @param fileName The path to the log file. @param append If true will append to fileName. Otherwise will truncate fileName. */ @@ -269,7 +271,7 @@ reset(); Writer fw = createWriter(new FileOutputStream(fileName, append)); if(bufferedIO) { - fw = new BufferedWriter(fw); + fw = new BufferedWriter(fw, bufferSize); } this.setQWForFiles(fw); this.fileName = fileName; 1.27 +8 -45 jakarta-log4j/src/java/org/apache/log4j/HTMLLayout.java Index: HTMLLayout.java =================================================================== RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/HTMLLayout.java,v retrieving revision 1.26 retrieving revision 1.27 diff -u -r1.26 -r1.27 --- HTMLLayout.java 24 Apr 2002 01:16:14 -0000 1.26 +++ HTMLLayout.java 25 Apr 2002 21:18:15 -0000 1.27 @@ -9,6 +9,7 @@ import org.apache.log4j.spi.LoggingEvent; import org.apache.log4j.spi.LocationInfo; +import org.apache.log4j.helpers.Transform; /** This layout outputs events in a HTML table. @@ -125,7 +126,7 @@ sbuf.append("</td>" + Layout.LINE_SEP); sbuf.append("<td title=\"" + event.getThreadName() + " thread\">"); - sbuf.append(escapeHTMLTags(event.getThreadName())); + sbuf.append(Transform.escapeTags(event.getThreadName())); sbuf.append("</td>" + Layout.LINE_SEP); sbuf.append("<td title=\"Level\">"); @@ -144,26 +145,26 @@ sbuf.append("</td>" + Layout.LINE_SEP); sbuf.append("<td title=\"" + event.categoryName + " category\">"); - sbuf.append(escapeHTMLTags(event.categoryName)); + sbuf.append(Transform.escapeTags(event.categoryName)); sbuf.append("</td>" + Layout.LINE_SEP); if(locationInfo) { LocationInfo locInfo = event.getLocationInformation(); sbuf.append("<td>"); - sbuf.append(escapeHTMLTags(locInfo.getFileName())); + sbuf.append(Transform.escapeTags(locInfo.getFileName())); sbuf.append(':'); sbuf.append(locInfo.getLineNumber()); sbuf.append("</td>" + Layout.LINE_SEP); } sbuf.append("<td title=\"Message\">"); - sbuf.append(escapeHTMLTags(event.getRenderedMessage())); + sbuf.append(Transform.escapeTags(event.getRenderedMessage())); sbuf.append("</td>" + Layout.LINE_SEP); sbuf.append("</tr>" + Layout.LINE_SEP); if (event.getNDC() != null) { sbuf.append("<tr><td bgcolor=\"#EEEEEE\" style=\"font-size : xx-small;\" colspan=\"6\" title=\"Nested Diagnostic Context\">"); - sbuf.append("NDC: " + escapeHTMLTags(event.getNDC())); + sbuf.append("NDC: " + Transform.escapeTags(event.getNDC())); sbuf.append("</td></tr>" + Layout.LINE_SEP); } @@ -182,11 +183,11 @@ int len = s.length; if(len == 0) return; - sbuf.append(escapeHTMLTags(s[0])); + sbuf.append(Transform.escapeTags(s[0])); sbuf.append(Layout.LINE_SEP); for(int i = 1; i < len; i++) { sbuf.append(TRACE_PREFIX); - sbuf.append(escapeHTMLTags(s[i])); + sbuf.append(Transform.escapeTags(s[i])); sbuf.append(Layout.LINE_SEP); } } @@ -245,43 +246,5 @@ public boolean ignoresThrowable() { return false; - } - - /** - * This method takes a string which may contain HTML tags (ie, <b>, <table>, - * etc) and converts the '<' and '>' characters to their HTML escape - * sequences. - * - * @param input The text to be converted. - * @return The input string with the characters '<' and '>' replaced with - * < and > respectively. - */ - private String escapeHTMLTags(String input) { - //Check if the string is null or zero length -- if so, return - //what was sent in. - - if( input == null || input.length() == 0 ) { - return input; - } - - //Use a StringBuffer in lieu of String concatenation -- it is - //much more efficient this way. - - StringBuffer buf = new StringBuffer(input.length() + 6); - char ch = ' '; - - int len = input.length(); - for(int i=0; i < len; i++) { - ch = input.charAt(i); - if(ch == '<') { - buf.append("<"); - } else if(ch == '>') { - buf.append(">"); - } else { - buf.append(ch); - } - } - - return buf.toString(); } } 1.17 +5 -48 jakarta-log4j/src/java/org/apache/log4j/xml/XMLLayout.java Index: XMLLayout.java =================================================================== RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/xml/XMLLayout.java,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- XMLLayout.java 21 Jan 2002 23:07:12 -0000 1.16 +++ XMLLayout.java 25 Apr 2002 21:18:15 -0000 1.17 @@ -3,7 +3,7 @@ * * This software is published under the terms of the Apache Software * License version 1.1, a copy of which has been included with this - * distribution in the LICENSE.APL file. */ + * distribution in the LICENSE.txt file. */ // Contributors: Mathias Bogaert @@ -14,6 +14,7 @@ import org.apache.log4j.spi.LocationInfo; import org.apache.log4j.helpers.OptionConverter; import org.apache.log4j.helpers.DateLayout; +import org.apache.log4j.helpers.Transform; /** The output of the XMLLayout consists of a series of log4j:event @@ -43,58 +44,13 @@ @since 0.9.0 */ public class XMLLayout extends Layout { - /** - This is a string constant to name the option for setting the - location information flag. Current value of this string constant - is <b>LocationInfo</b>. - - <p>See the {@link #setOption(java.lang.String, java.lang.String)} - method for the meaning of this option. - - <p>Note all option keys are case sensitive. - - @deprecated Options are now handled using the JavaBeans paradigm. - This constant is not longer needed and will be removed in the - <em>near</em> term. - */ - public static final String LOCATION_INFO_OPTION = "LocationInfo"; - private final int DEFAULT_SIZE = 256; private final int UPPER_LIMIT = 2048; private StringBuffer buf = new StringBuffer(DEFAULT_SIZE); private boolean locationInfo = false; - /** - @deprecated We now use JavaBeans introspection to configure - components. Options strings are no longer needed. - */ - public - String[] getOptionStrings() { - return new String[]{LOCATION_INFO_OPTION}; - } - - /** - - The XMLLayout specific options are: - - <p>The <b>LocationInfo</b> option takes a boolean value. If true, - the output will include location information. By default no - location information is sent to the server. - - @deprecated Use the setter method for the option directly instead - of the generic <code>setOption</code> method. - - */ - public - void setOption(String key, String value) { - - if(value == null) return; - if (key.equals(LOCATION_INFO_OPTION)) { - locationInfo = OptionConverter.toBoolean(value, locationInfo); - } - } - + /** The <b>LocationInfo</b> option takes a boolean value. By default, it is set to false which means there will be no location @@ -166,6 +122,7 @@ buf.append("<log4j:throwable><![CDATA["); for(int i = 0; i < s.length; i++) { buf.append(s[i]); + buf.append("\r\n"); } buf.append("]]></log4j:throwable>\r\n"); } @@ -175,7 +132,7 @@ buf.append("<log4j:locationInfo class=\""); buf.append(locationInfo.getClassName()); buf.append("\" method=\""); - buf.append(locationInfo.getMethodName()); + buf.append(Transform.escapeTags(locationInfo.getMethodName())); buf.append("\" file=\""); buf.append(locationInfo.getFileName()); buf.append("\" line=\""); 1.11 +6 -4 jakarta-log4j/src/xdocs/contactUs.xml Index: contactUs.xml =================================================================== RCS file: /home/cvs/jakarta-log4j/src/xdocs/contactUs.xml,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- contactUs.xml 11 Feb 2002 16:14:34 -0000 1.10 +++ contactUs.xml 25 Apr 2002 21:18:15 -0000 1.11 @@ -16,10 +16,12 @@ <p>Before reporting a problem, please <a href="http://nagoya.apache.org/bugzilla/query.cgi">check the database</a> and the <a href="HISTORY">project history file</a> to see -if the problem is not already known. After this verification step, you -are highly encouraged to send email to the <em>log4j-user</em> -mailing list (see below) describing the bug. Only after these -precautionary steps should you file a bug report.</p> +if the problem is not already known. After this first verification +step, you are highly encouraged to send email to the +<em>log4j-user</em> mailing list (see below) describing the bug. Only +after these precautionary steps should you file a bug +report. Moreover, requests for enhancements should not be entered in +Bugzilla but posted on the log4j-user mailing list instead.</p> </section>
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>