logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@locus.apache.org
Subject cvs commit: jakarta-log4j/org/log4j/test ConfigurationFileParsing.java DelayedLoop.java Makefile PatternTest.java Shallow.java
Date Thu, 14 Dec 2000 17:15:24 GMT
ceki        00/12/14 09:15:22

  Modified:    org/log4j HTMLLayout.java
               org/log4j/net SyslogTracerPrintWriter.java
               org/log4j/test ConfigurationFileParsing.java
                        DelayedLoop.java Makefile PatternTest.java
                        Shallow.java
  Removed:     org/log4j/spi ObjectRenderer.java
  Log:
  spi/ObjectRenderer.java was entirely superflous.
  HTMLLayout.java now correctly formats Exceptions.
  Other minor stuff.
  
  Revision  Changes    Path
  1.2       +40 -1     jakarta-log4j/org/log4j/HTMLLayout.java
  
  Index: HTMLLayout.java
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/org/log4j/HTMLLayout.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- HTMLLayout.java	2000/12/14 02:19:26	1.1
  +++ HTMLLayout.java	2000/12/14 17:14:46	1.2
  @@ -2,6 +2,9 @@
   package org.log4j;
   
   import org.log4j.spi.LoggingEvent;
  +import java.io.StringWriter;
  +import java.io.PrintWriter;
  +import java.io.Writer;
   
   
   public class HTMLLayout extends Layout {
  @@ -49,7 +52,7 @@
   
       if(event.throwable != null) {
         sbuf.append("\r\n<tr><td colspan=\"5\">");
  -      sbuf.append(event.getThrowableInformation());
  +      sbuf.append(getThrowableAsHTML(event.throwable));
         sbuf.append("</td></tr>");
       }
   
  @@ -66,6 +69,8 @@
       return "text/html";
     }
   
  +  
  +
     /**
        Returns appropriate HTML headers.
     */
  @@ -89,7 +94,18 @@
       return new String[0];
     }
   
  +  String getThrowableAsHTML(Throwable throwable) {
  +    if(throwable == null) 
  +      return null;
  + 
  +    StringWriter sw = new StringWriter();
  +    HTMLPrintWriter hpw = new HTMLPrintWriter(sw);
  +
  +    throwable.printStackTrace(hpw);
  +    return sw.toString();
  +  }
   
  +
     public
     boolean ignoresThrowable() {
       return false;
  @@ -97,5 +113,28 @@
   
     public
     void setOption(String key, String value) {
  +  }
  +
  +  static class HTMLPrintWriter extends PrintWriter {
  +    
  +    static String TRACE_PREFIX = "<br>&nbsp;&nbsp;&nbsp;&nbsp;";
  +
  +    public
  +    HTMLPrintWriter(Writer writer) {
  +      super(writer);
  +    }
  +
  +    public
  +    void println(char[] c) {
  +      write(TRACE_PREFIX);
  +      this.write(c);
  +    }
  +
  +  
  +    public
  +    void println(String s) {
  +      write(TRACE_PREFIX);
  +      this.write(s);
  +    }    
     }
   }
  
  
  
  1.2       +5 -1      jakarta-log4j/org/log4j/net/SyslogTracerPrintWriter.java
  
  Index: SyslogTracerPrintWriter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/org/log4j/net/SyslogTracerPrintWriter.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SyslogTracerPrintWriter.java	2000/12/14 09:31:29	1.1
  +++ SyslogTracerPrintWriter.java	2000/12/14 17:14:50	1.2
  @@ -20,12 +20,16 @@
     }
   
     /**
  -     Make the first Exception line print properly by omitting the \n ath the end.
  +     Make the first Exception line print properly by omitting the \n ath the 
  +     end.
     */
     public
      void println(Object o) {
       this.qWriter.write(o.toString());
     }
  +
  +  // Note: the Char[] form is handled by the TracerPrinterWriter super
  +  // class
   
     /**
        Remove the first character from the string (usually a TAB) and do
  
  
  
  1.2       +6 -0      jakarta-log4j/org/log4j/test/ConfigurationFileParsing.java
  
  Index: ConfigurationFileParsing.java
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/org/log4j/test/ConfigurationFileParsing.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ConfigurationFileParsing.java	2000/12/14 09:12:26	1.1
  +++ ConfigurationFileParsing.java	2000/12/14 17:15:03	1.2
  @@ -1,3 +1,9 @@
  +/*
  + * Copyright (C) The Apache Software Foundation. All rights reserved.
  + *
  + * 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.  */
   
   package org.log4j.test; 
   
  
  
  
  1.2       +7 -3      jakarta-log4j/org/log4j/test/DelayedLoop.java
  
  Index: DelayedLoop.java
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/org/log4j/test/DelayedLoop.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DelayedLoop.java	2000/12/14 09:12:26	1.1
  +++ DelayedLoop.java	2000/12/14 17:15:04	1.2
  @@ -1,5 +1,9 @@
  -// Copyright (c) 2000 Ceki Gulcu. All Rights Reserved.
  -// See the LICENCE file for the terms of usage and distribution.
  +/*
  + * Copyright (C) The Apache Software Foundation. All rights reserved.
  + *
  + * 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.  */
   
   package org.log4j.test; 
   
  @@ -16,7 +20,7 @@
      @author Ceki G&uuml;lc&uuml; */
   public class DelayedLoop {
   
  -  static Category cat = Category.getInstance(DelayedLoop.class.getName());
  +  static Category cat = Category.getInstance(DelayedLoop.class);
     static int loopLength;
   
     public 
  
  
  
  1.2       +1 -0      jakarta-log4j/org/log4j/test/Makefile
  
  Index: Makefile
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/org/log4j/test/Makefile,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Makefile	2000/12/14 09:12:26	1.1
  +++ Makefile	2000/12/14 17:15:05	1.2
  @@ -2,6 +2,7 @@
   PKG_DIR :=org/log4j/test
   DEPTH   :=../../..
   JSOURCES:= Shallow.java\
  + Hello.java\
    StressNDC.java\
    StressAsyncAppender.java\
    Min.java Base64.java\
  
  
  
  1.2       +1 -1      jakarta-log4j/org/log4j/test/PatternTest.java
  
  Index: PatternTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/org/log4j/test/PatternTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PatternTest.java	2000/12/14 09:12:27	1.1
  +++ PatternTest.java	2000/12/14 17:15:05	1.2
  @@ -10,7 +10,7 @@
      @author Ceki G&uuml;lc&uuml;
   */
   public class PatternTest {
  -  static Category CAT = Category.getInstance(PatternTest.class.getName());
  +  static Category CAT = Category.getInstance(PatternTest.class);
   
   
     public 
  
  
  
  1.2       +1 -1      jakarta-log4j/org/log4j/test/Shallow.java
  
  Index: Shallow.java
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/org/log4j/test/Shallow.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Shallow.java	2000/12/14 09:12:28	1.1
  +++ Shallow.java	2000/12/14 17:15:06	1.2
  @@ -19,7 +19,7 @@
   */
   public class Shallow {
     
  -  static Category cat = Category.getInstance(Shallow.class.getName());
  +  static Category cat = Category.getInstance(Shallow.class);
     
     public 
     static 
  
  
  

Mime
View raw message