User: fleury  
  Date: 00/09/29 14:25:21

  Modified:    src/main/org/jboss/logging Log.java
  Log:
  Updated exception handling in entire server
  Log is now inherited in child threads (e.g. useful for Tomcat which spawns threads)
  
  Revision  Changes    Path
  1.2       +19 -2     jboss/src/main/org/jboss/logging/Log.java
  
  Index: Log.java
  ===================================================================
  RCS file: /products/cvs/ejboss/jboss/src/main/org/jboss/logging/Log.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Log.java  2000/04/22 14:30:13     1.1
  +++ Log.java  2000/09/29 21:25:21     1.2
  @@ -17,7 +17,7 @@
    *      
    *   @see <related>
    *   @author Rickard �berg ([EMAIL PROTECTED])
  - *   @version $Revision: 1.1 $
  + *   @version $Revision: 1.2 $
    */
   public class Log
   {
  @@ -31,7 +31,7 @@
      Object source = null;
      
      // Static --------------------------------------------------------
  -   static ThreadLocal currentLog = new ThreadLocal();
  +   static ThreadLocal currentLog = new InheritedThreadLocal();
      static Log defaultLog = new Log();
      
      public static void setLog(Log log)
  @@ -116,6 +116,23 @@
         {
            while((error = din.readLine()) != null)
               log("Error", error);
  +      } catch (Exception e) {}
  +   }
  +   
  +   public synchronized void debug(Throwable exception)
  +   {
  +      ByteArrayOutputStream baos = new ByteArrayOutputStream();
  +      PrintStream out = new PrintStream(baos);
  +      exception.printStackTrace(out);
  +      out.close();
  +      
  +      DataInputStream din = new DataInputStream(new 
ByteArrayInputStream(baos.toByteArray()));
  +      
  +      String error;
  +      try
  +      {
  +         while((error = din.readLine()) != null)
  +            log("Debug", error);
         } catch (Exception e) {}
      }
      
  
  
  

Reply via email to