logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From h...@apache.org
Subject cvs commit: logging-log4j-sandbox/src/java/org/apache/log4j/servlet ServletContextLogAppender.java
Date Fri, 02 Jul 2004 21:32:47 GMT
hoju        2004/07/02 14:32:47

  Modified:    src/java/org/apache/log4j/servlet
                        ServletContextLogAppender.java
  Log:
  Added capability to log Throwable information if available.  Suggested by Stefan Armbruster.
  
  Jake
  
  Revision  Changes    Path
  1.3       +8 -1      logging-log4j-sandbox/src/java/org/apache/log4j/servlet/ServletContextLogAppender.java
  
  Index: ServletContextLogAppender.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j-sandbox/src/java/org/apache/log4j/servlet/ServletContextLogAppender.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ServletContextLogAppender.java	28 Feb 2004 13:55:05 -0000	1.2
  +++ ServletContextLogAppender.java	2 Jul 2004 21:32:47 -0000	1.3
  @@ -18,6 +18,7 @@
   
   import org.apache.log4j.AppenderSkeleton;
   import org.apache.log4j.spi.LoggingEvent;
  +import org.apache.log4j.spi.ThrowableInformation;
   
   import java.util.Collections;
   import java.util.HashMap;
  @@ -120,7 +121,13 @@
       }
   
       // Output log message
  -    servletContext.log(layout.format(event));
  +    String s = layout.format(event);
  +    ThrowableInformation ti = event.getThrowableInformation();
  +    if (ti == null) {
  +        servletContext.log(s);
  +    } else {
  +        servletContext.log(s, ti.getThrowable());
  +    }
   
       return;
     }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


Mime
View raw message