You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by sd...@apache.org on 2003/11/02 20:53:48 UTC

cvs commit: jakarta-log4j/src/java/org/apache/log4j/chainsaw/rule RuleTest.java

sdeboy      2003/11/02 11:53:48

  Modified:    src/java/org/apache/log4j/net UDPAppender.java
                        MulticastReceiver.java MulticastAppender.java
                        UDPReceiver.java XMLSocketReceiver.java
               src/java/org/apache/log4j/spi LoggingEvent.java
                        LocationInfo.java
               src/java/org/apache/log4j/chainsaw
                        ChainsawAppenderHandler.java ColumnComparator.java
                        LogPanel.java FileLoadAction.java
                        ReceiversPanel.java LoggingEventFieldResolver.java
                        ChainsawCyclicBufferTableModel.java
                        ChainsawEventBatchEntry.java
                        ReceiversTreeModel.java
               .        build.xml
               src/java/org/apache/log4j UtilLoggingLevel.java
               src/java/org/apache/log4j/chainsaw/layout
                        EventDetailLayout.java
               src/java/org/apache/log4j/xml UtilLoggingXMLDecoder.java
                        XMLDecoder.java
               src/java/org/apache/log4j/chainsaw/filter FilterModel.java
               src/java/org/apache/log4j/chainsaw/rule RuleTest.java
  Added:       src/java/org/apache/log4j/chainsaw
                        Details_XMLSocketReceiver.html
  Log:
  Bug fix commit
  Changes:
  
  * build.xml - copy logger.dtd into jar
  * locationinfo - non-log4j apps may only specify a subset of the locationinfo fields (the rest would be null), a check was added to prevent an NPE on each accessor
  * loggingevent - Added locationInformationExists method (getLocationInfo creates a location info if it does not exist), and added exist checks to code as needed to prevent location info construction
  * loggingevent - modified setProperty behavior, if value is null, the property is removed
  * receiverpanel - add xmlsocketreceiver support(built-in support for reception of xml-formatted log4j events via tcp socket)
  * utillogginglevel - modified intvalues so that the lowest value is greater than log4j's debug level intvalue (so the appender skeleton would forward the events correctly with threshold set to debug)
  * fileloadaction - when attempting to load an xml file, directories are displayed as well as xml files
  * modified thread code in chainsawappenderhandler in an attempt to improve performance
  * multicastappender/udpappender - removing internally specified properties (log4japp/log4jmachine name) so the rest of the appenders in the appender chain could specify these properties themselves or the default behavior of using the remote machine could be used
  * multicastappender/receiver, udpappender/receiver added encoding support (chartset) as a property.  If none set, the default system encoding is used.
  * xmlsocketreceiver/udpreceiver/multicastreceiver - added pausable support (useful in receiver panel)
  
  Revision  Changes    Path
  1.3       +25 -6     jakarta-log4j/src/java/org/apache/log4j/net/UDPAppender.java
  
  Index: UDPAppender.java
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/net/UDPAppender.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- UDPAppender.java	26 Jun 2003 22:58:11 -0000	1.2
  +++ UDPAppender.java	2 Nov 2003 19:53:47 -0000	1.3
  @@ -49,17 +49,16 @@
   
   package org.apache.log4j.net;
   
  -import org.apache.log4j.AppenderSkeleton;
  -import org.apache.log4j.helpers.LogLog;
  -import org.apache.log4j.spi.LoggingEvent;
  -
   import java.io.IOException;
  -
   import java.net.DatagramPacket;
   import java.net.DatagramSocket;
   import java.net.InetAddress;
   import java.net.UnknownHostException;
   
  +import org.apache.log4j.AppenderSkeleton;
  +import org.apache.log4j.helpers.LogLog;
  +import org.apache.log4j.spi.LoggingEvent;
  +
   
   /**
    * 
  @@ -102,6 +101,7 @@
     String localMachine;
     String remoteHost;
     String log4japp;
  +  String encoding;
     String overrideProperties = "true";
     InetAddress address;
     int port = DEFAULT_PORT;
  @@ -243,9 +243,13 @@
           if (buf.length() < PACKET_LENGTH) {        
              buf.append(new char[PACKET_LENGTH - buf.length()]);
           }
  +        //the implementation of string.getBytes accepts a null encoding and uses the system charset
           DatagramPacket dp =
  -           new DatagramPacket(buf.toString().getBytes("ASCII"), buf.length(), address, port);
  +           new DatagramPacket(buf.toString().getBytes(encoding), buf.length(), address, port);
           outSocket.send(dp);
  +        //remove these properties, in case other appenders need to set them to different values 
  +        event.setProperty("log4jmachinename", null);
  +        event.setProperty("log4japp", null);
         } catch (IOException e) {
           outSocket = null;
           LogLog.warn("Detected problem with UDP connection: " + e);
  @@ -314,6 +318,21 @@
      */
     public String getLog4JApp() {
       return log4japp;
  +  }
  +
  +  /**
  +     The <b>Encoding</b> option specifies how the bytes are encoded.  If this option is not specified, 
  +     the System encoding is used.
  +   */
  +  public void setEncoding(String encoding) {
  +    this.encoding = encoding;
  +  }
  +
  +  /**
  +     Returns value of the <b>Encoding</b> option.
  +   */
  +  public String getEncoding() {
  +    return encoding;
     }
   
     /**
  
  
  
  1.3       +75 -21    jakarta-log4j/src/java/org/apache/log4j/net/MulticastReceiver.java
  
  Index: MulticastReceiver.java
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/net/MulticastReceiver.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- MulticastReceiver.java	9 Jul 2003 06:10:01 -0000	1.2
  +++ MulticastReceiver.java	2 Nov 2003 19:53:47 -0000	1.3
  @@ -51,6 +51,7 @@
   
   import org.apache.log4j.Decoder;
   import org.apache.log4j.helpers.LogLog;
  +import org.apache.log4j.plugins.Pauseable;
   import org.apache.log4j.plugins.Receiver;
   import org.apache.log4j.spi.LoggingEvent;
   
  @@ -66,6 +67,7 @@
   import java.util.Iterator;
   import java.util.List;
   
  +
   /**
    *  Multicast-based receiver.  Accepts LoggingEvents encoded using
    *  MulticastAppender and XMLLayout. The the XML data is converted
  @@ -74,18 +76,22 @@
    *  @author Scott Deboy <sd...@apache.org>
    *
    */
  -public class MulticastReceiver extends Receiver implements PortBased, AddressBased {
  +public class MulticastReceiver extends Receiver implements PortBased,
  +  AddressBased, Pauseable {
     private static final int PACKET_LENGTH = 16384;
     private boolean isActive = false;
     private int port;
     private String address;
  +  private String encoding;
     private MulticastSocket socket = null;
   
     //default to log4j xml decoder
     private String decoder = "org.apache.log4j.xml.XMLDecoder";
     private Decoder decoderImpl;
     private MulticastHandlerThread handlerThread;
  -  
  +  private MulticastReceiverThread receiverThread;
  +  private boolean paused;
  +
     public String getDecoder() {
       return decoder;
     }
  @@ -106,8 +112,25 @@
       return address;
     }
   
  +  /**
  +      The <b>Encoding</b> option specifies how the bytes are encoded.  If this option is not specified,
  +      the system encoding will be used.
  +    */
  +  public void setEncoding(String encoding) {
  +    this.encoding = encoding;
  +  }
  +
  +  /**
  +     Returns value of the <b>Encoding</b> option.
  +   */
  +  public String getEncoding() {
  +    return encoding;
  +  }
  +
     public synchronized void shutdown() {
       isActive = false;
  +    handlerThread.interrupt();
  +    receiverThread.interrupt();
       socket.close();
     }
   
  @@ -115,10 +138,18 @@
       this.address = address;
     }
   
  +  public boolean isPaused() {
  +    return paused;
  +  }
  +
  +  public void setPaused(boolean b) {
  +    paused = b;
  +  }
  +
     /**
  -    Sets the flag to indicate if receiver is active or not. */
  -  public synchronized void setActive(boolean isActive) {
  -    this.isActive = isActive;
  +    Returns true if this receiver is active. */
  +  public synchronized boolean isActive() {
  +    return isActive;
     }
   
     public void activateOptions() {
  @@ -132,11 +163,11 @@
           this.decoderImpl = (Decoder) o;
         }
       } catch (ClassNotFoundException cnfe) {
  -    	LogLog.warn("Unable to find decoder", cnfe);
  +      LogLog.warn("Unable to find decoder", cnfe);
       } catch (IllegalAccessException iae) {
  -    	LogLog.warn("Could not construct decoder", iae);
  +      LogLog.warn("Could not construct decoder", iae);
       } catch (InstantiationException ie) {
  -    	LogLog.warn("Could not construct decoder", ie);
  +      LogLog.warn("Could not construct decoder", ie);
       }
   
       try {
  @@ -146,12 +177,13 @@
       }
   
       try {
  +      isActive = true;
         socket = new MulticastSocket(port);
         socket.joinGroup(addr);
  -      new MulticastReceiverThread().start();
  +      receiverThread = new MulticastReceiverThread();
  +      receiverThread.start();
         handlerThread = new MulticastHandlerThread();
         handlerThread.start();
  -      setActive(true);
       } catch (IOException ioe) {
         ioe.printStackTrace();
       }
  @@ -167,17 +199,25 @@
       public void append(String data) {
         synchronized (list) {
           list.add(data);
  +        list.notify();
         }
       }
   
  -    public synchronized void run() {
  +    public void run() {
         ArrayList list2 = new ArrayList();
   
         while (isAlive()) {
           synchronized (list) {
  -          if (list.size() > 0) {
  -            list2.addAll(list);
  -            list.clear();
  +          try {
  +            while (list.size() == 0) {
  +              list.wait();
  +            }
  +
  +            if (list.size() > 0) {
  +              list2.addAll(list);
  +              list.clear();
  +            }
  +          } catch (InterruptedException ie) {
             }
           }
   
  @@ -186,12 +226,15 @@
   
             while (iter.hasNext()) {
               String data = (String) iter.next();
  -			List v= decoderImpl.decodeEvents(data);
  +            List v = decoderImpl.decodeEvents(data);
   
               if (v != null) {
                 Iterator eventIter = v.iterator();
  +
                 while (eventIter.hasNext()) {
  -				doPost((LoggingEvent)eventIter.next());
  +                if (!isPaused()) {
  +                  doPost((LoggingEvent) eventIter.next());
  +                }
                 }
               }
             }
  @@ -199,7 +242,9 @@
             list2.clear();
           } else {
             try {
  -            wait(1000);
  +            synchronized (this) {
  +              wait(1000);
  +            }
             } catch (InterruptedException ie) {
             }
           }
  @@ -213,7 +258,7 @@
       }
   
       public void run() {
  -      setActive(true);
  +      isActive = true;
   
         byte[] b = new byte[PACKET_LENGTH];
         DatagramPacket p = new DatagramPacket(b, b.length);
  @@ -222,14 +267,23 @@
           try {
             socket.receive(p);
   
  -          String data = new String(p.getData(), 0, p.getLength()).trim();
  -          handlerThread.append(data);
  +          //this string constructor which accepts a charset throws an exception if it is 
  +          //null
  +            if (encoding == null) {
  +            handlerThread.append(
  +              new String(p.getData(), 0, p.getLength()).trim());
  +          } else {
  +            handlerThread.append(
  +              new String(p.getData(), 0, p.getLength(), encoding).trim());
  +          }
           } catch (SocketException se) {
  -	    	//disconnected
  +          //disconnected
           } catch (IOException ioe) {
             ioe.printStackTrace();
           }
         }
  +
  +      LogLog.debug(MulticastReceiver.this.getName() + "'s thread is ending.");
       }
     }
   }
  
  
  
  1.2       +24 -6     jakarta-log4j/src/java/org/apache/log4j/net/MulticastAppender.java
  
  Index: MulticastAppender.java
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/net/MulticastAppender.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- MulticastAppender.java	24 Jun 2003 08:21:52 -0000	1.1
  +++ MulticastAppender.java	2 Nov 2003 19:53:47 -0000	1.2
  @@ -49,17 +49,16 @@
   
   package org.apache.log4j.net;
   
  -import org.apache.log4j.AppenderSkeleton;
  -import org.apache.log4j.helpers.LogLog;
  -import org.apache.log4j.spi.LoggingEvent;
  -
   import java.io.IOException;
  -
   import java.net.DatagramPacket;
   import java.net.InetAddress;
   import java.net.MulticastSocket;
   import java.net.UnknownHostException;
   
  +import org.apache.log4j.AppenderSkeleton;
  +import org.apache.log4j.helpers.LogLog;
  +import org.apache.log4j.spi.LoggingEvent;
  +
   
   /**
    *  Multicast-based Appender.  Works in conjunction with the MulticastReceiver, which expects
  @@ -109,6 +108,7 @@
     int reconnectionDelay = DEFAULT_RECONNECTION_DELAY;
     boolean locationInfo = false;
     int count = 0;
  +  private String encoding;
     
     public MulticastAppender() {
     }
  @@ -232,9 +232,13 @@
           if (buf.length() < PACKET_LENGTH) {
             buf.append(new char[PACKET_LENGTH - buf.length()]);
           }
  +        //the implementation of string.getBytes accepts a null encoding and uses the system charset
           DatagramPacket dp =
  -          new DatagramPacket(buf.toString().getBytes("ASCII"), buf.length(), address, port);
  +          new DatagramPacket(buf.toString().getBytes(encoding), buf.length(), address, port);
           outSocket.send(dp);
  +        //remove these properties, in case other appenders need to set them to different values 
  +        event.setProperty("log4jmachinename", null);
  +        event.setProperty("log4japp", null);
         } catch (IOException e) {
           outSocket = null;
           LogLog.warn("Detected problem with Multicast connection: " + e);
  @@ -277,6 +281,20 @@
       return remoteHost;
     }
   
  +  /**
  +      The <b>Encoding</b> option specifies how the bytes are encoded.  If this option is not specified, 
  +      the System encoding is used.
  +    */
  +   public void setEncoding(String encoding) {
  +     this.encoding = encoding;
  +   }
  +
  +   /**
  +      Returns value of the <b>Encoding</b> option.
  +    */
  +   public String getEncoding() {
  +     return encoding;
  +   }
     /**
        The <b>App</b> option takes a string value which should be the name of the application getting logged.
        If property was already set (via system property), don't set here.
  
  
  
  1.3       +78 -33    jakarta-log4j/src/java/org/apache/log4j/net/UDPReceiver.java
  
  Index: UDPReceiver.java
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/net/UDPReceiver.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- UDPReceiver.java	9 Jul 2003 06:10:01 -0000	1.2
  +++ UDPReceiver.java	2 Nov 2003 19:53:47 -0000	1.3
  @@ -49,21 +49,20 @@
   
   package org.apache.log4j.net;
   
  -import org.apache.log4j.Decoder;
  -import org.apache.log4j.helpers.LogLog;
  -import org.apache.log4j.plugins.Receiver;
  -import org.apache.log4j.spi.LoggingEvent;
  -
   import java.io.IOException;
  -
   import java.net.DatagramPacket;
   import java.net.DatagramSocket;
   import java.net.SocketException;
  -
   import java.util.ArrayList;
   import java.util.Iterator;
   import java.util.List;
   
  +import org.apache.log4j.Decoder;
  +import org.apache.log4j.helpers.LogLog;
  +import org.apache.log4j.plugins.Pauseable;
  +import org.apache.log4j.plugins.Receiver;
  +import org.apache.log4j.spi.LoggingEvent;
  +
   
   /**
    *  Receive LoggingEvents encoded with an XMLLayout, convert the XML data to a
  @@ -72,14 +71,15 @@
    *  @author Scott Deboy <sd...@apache.org>
    *
    */
  -public class UDPReceiver extends Receiver implements PortBased{
  -  private UDPReceiverThread receiverThread;
  -
  +public class UDPReceiver extends Receiver implements PortBased, Pauseable {
     private static final int PACKET_LENGTH = 16384;
  +  private UDPReceiverThread receiverThread;
  +  private String encoding;
   
     //default to log4j xml decoder
     private String decoder = "org.apache.log4j.xml.XMLDecoder";
     private Decoder decoderImpl;
  +  protected boolean paused;
     private boolean isActive = false;
     private int port;
     private DatagramSocket socket;
  @@ -93,6 +93,21 @@
       this.port = port;
     }
   
  +  /**
  +      The <b>Encoding</b> option specifies how the bytes are encoded.  If this option is not specified,
  +      the system encoding will be used.
  +    */
  +  public void setEncoding(String encoding) {
  +    this.encoding = encoding;
  +  }
  +
  +  /**
  +     Returns value of the <b>Encoding</b> option.
  +   */
  +  public String getEncoding() {
  +    return encoding;
  +  }
  +
     public String getDecoder() {
       return decoder;
     }
  @@ -101,6 +116,14 @@
       this.decoder = decoder;
     }
   
  +  public boolean isPaused() {
  +    return paused;
  +  }
  +
  +  public void setPaused(boolean b) {
  +    paused = b;
  +  }
  +
     public synchronized void shutdown() {
       isActive = false;
       handlerThread.interrupt();
  @@ -114,7 +137,6 @@
       return isActive;
     }
   
  -
     public void activateOptions() {
       try {
         Class c = Class.forName(decoder);
  @@ -124,20 +146,20 @@
           this.decoderImpl = (Decoder) o;
         }
       } catch (ClassNotFoundException cnfe) {
  -    	LogLog.warn("Unable to find decoder", cnfe);
  +      LogLog.warn("Unable to find decoder", cnfe);
       } catch (IllegalAccessException iae) {
  -    	LogLog.warn("Could not construct decoder", iae);
  +      LogLog.warn("Could not construct decoder", iae);
       } catch (InstantiationException ie) {
  -    	LogLog.warn("Could not construct decoder", ie);
  +      LogLog.warn("Could not construct decoder", ie);
       }
   
       try {
  -      isActive=true;
  +      isActive = true;
         socket = new DatagramSocket(port);
         receiverThread = new UDPReceiverThread();
         receiverThread.start();
  -	  handlerThread = new UDPHandlerThread();
  -	  handlerThread.start();
  +      handlerThread = new UDPHandlerThread();
  +      handlerThread.start();
       } catch (IOException ioe) {
         ioe.printStackTrace();
       }
  @@ -153,17 +175,25 @@
       public void append(String data) {
         synchronized (list) {
           list.add(data);
  +        list.notify();
         }
       }
   
  -    public synchronized void run() {
  +    public void run() {
         ArrayList list2 = new ArrayList();
   
         while (isAlive() && isActive()) {
           synchronized (list) {
  -          if (list.size() > 0) {
  -            list2.addAll(list);
  -            list.clear();
  +          try {
  +            while (list.size() == 0) {
  +              list.wait();
  +            }
  +
  +            if (list.size() > 0) {
  +              list2.addAll(list);
  +              list.clear();
  +            }
  +          } catch (InterruptedException ie) {
             }
           }
   
  @@ -172,12 +202,15 @@
   
             while (iter.hasNext()) {
               String data = (String) iter.next();
  -			List v= decoderImpl.decodeEvents(data);
  +            List v = decoderImpl.decodeEvents(data);
   
               if (v != null) {
                 Iterator eventIter = v.iterator();
  +
                 while (eventIter.hasNext()) {
  -				doPost((LoggingEvent)eventIter.next());;
  +                if (!isPaused()) {
  +                  doPost((LoggingEvent) eventIter.next());
  +                }
                 }
               }
             }
  @@ -185,15 +218,20 @@
             list2.clear();
           } else {
             try {
  -            wait(1000);
  +            synchronized (this) {
  +              wait(1000);
  +            }
             } catch (InterruptedException ie) {
  +          }
           }
         }
  +
  +      if (!isActive()) {
  +        LogLog.debug(
  +          UDPReceiver.this.getName()
  +          + "'s handler thread is exiting because of shutdown");
  +      }
       }
  -    if(!isActive()){
  -      LogLog.debug(UDPReceiver.this.getName() + "'s handler thread is exiting because of shutdown");
  -    }
  -  }
     }
   
     class UDPReceiverThread extends Thread {
  @@ -211,15 +249,22 @@
           try {
             socket.receive(p);
   
  -          String data = new String(p.getData(), 0, p.getLength()).trim();
  -          handlerThread.append(data);
  -        }
  -        catch (SocketException se) {
  -        	//disconnected
  +          //this string constructor which accepts a charset throws an exception if it is 
  +          //null
  +          if (encoding == null) {
  +            handlerThread.append(
  +              new String(p.getData(), 0, p.getLength()).trim());
  +          } else {
  +            handlerThread.append(
  +              new String(p.getData(), 0, p.getLength(), encoding).trim());
  +          }
  +        } catch (SocketException se) {
  +          //disconnected
           } catch (IOException ioe) {
             ioe.printStackTrace();
           }
         }
  +
         LogLog.debug(UDPReceiver.this.getName() + "'s thread is ending.");
       }
     }
  
  
  
  1.4       +105 -30   jakarta-log4j/src/java/org/apache/log4j/net/XMLSocketReceiver.java
  
  Index: XMLSocketReceiver.java
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/net/XMLSocketReceiver.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- XMLSocketReceiver.java	20 Oct 2003 05:27:15 -0000	1.3
  +++ XMLSocketReceiver.java	2 Nov 2003 19:53:47 -0000	1.4
  @@ -49,17 +49,18 @@
   
   package org.apache.log4j.net;
   
  -import org.apache.log4j.helpers.LogLog;
  -import org.apache.log4j.plugins.Receiver;
  -import org.apache.log4j.plugins.Plugin;
  -import org.apache.log4j.spi.LoggerRepository;
  -
   import java.net.ServerSocket;
   import java.net.Socket;
  -
   import java.util.List;
   import java.util.Vector;
   
  +import org.apache.log4j.helpers.LogLog;
  +import org.apache.log4j.plugins.Pauseable;
  +import org.apache.log4j.plugins.Plugin;
  +import org.apache.log4j.plugins.Receiver;
  +import org.apache.log4j.spi.LoggerRepository;
  +import org.apache.log4j.spi.LoggingEvent;
  +
   
   /**
     XMLSocketReceiver receives a remote logging event via XML on a configured
  @@ -73,14 +74,17 @@
     @author Mark Womack
     @since 1.3
   */
  -public class XMLSocketReceiver extends Receiver implements Runnable, PortBased {
  +public class XMLSocketReceiver extends Receiver implements Runnable, PortBased, Pauseable {
     protected int port;
     protected boolean active = false;
  -
  +  private boolean paused;
  +  private boolean shutdown;
     //default to log4j xml decoder
     protected String decoder = "org.apache.log4j.xml.XMLDecoder";
     private ServerSocket serverSocket;
     private List socketList = new Vector();
  +  private Thread rThread;
  +  public static int DEFAULT_PORT = 4448;
   
     public XMLSocketReceiver() {
     }
  @@ -114,6 +118,14 @@
       decoder = _decoder;
     }
   
  +  public boolean isPaused() {
  +    return paused;
  +  }
  +
  +  public void setPaused(boolean b) {
  +    paused = b;
  +  }
  +
     /**
      * Returns true if the receiver is the same class and they are
      * configured for the same properties, and super class also considers
  @@ -150,7 +162,7 @@
       Starts the SocketReceiver with the current options. */
     public void activateOptions() {
       if (!isActive()) {
  -      Thread rThread = new Thread(this);
  +      rThread = new Thread(this);
         rThread.setDaemon(true);
         rThread.start();
         active = true;
  @@ -164,32 +176,82 @@
       // mark this as no longer running
       active = false;
   
  -    // close the server socket
  -    try {
  -      if (serverSocket != null) {
  -        serverSocket.close();
  -      }
  -    } catch (Exception e) {
  -    	//ignore for now
  +    if (rThread != null) {
  +      rThread.interrupt();
  +      rThread = null;
       }
  +    doShutdown();
  +  }
   
  -    // close all of the accepted sockets
  -    for (int x = 0; x < socketList.size(); x++) {
  -      try {
  -        ((Socket) socketList.get(x)).close();
  -      } catch (Exception e) {
  -    	//ignore for now
  -      }
  +    /**
  +     * Does the actual shutting down by closing the server socket
  +     * and any connected sockets that have been created.
  +     */
  +    private synchronized void doShutdown() {
  +      active = false;
  +
  +      LogLog.debug(getName() + " doShutdown called");
  +
  +      // close the server socket
  +      closeServerSocket();
  +
  +      // close all of the accepted sockets
  +      closeAllAcceptedSockets();
  +
  +      setShutdown(true);
       }
   
  -    // clear member variables
  -    serverSocket = null;
  -    socketList.clear();
  -  }
  +    /**
  +     * @param b
  +     */
  +    private void setShutdown(boolean b) {
  +      shutdown = b;
  +    }
  +
  +
  +    /**
  +      * Closes the server socket, if created.
  +      */
  +     private void closeServerSocket() {
  +       LogLog.debug(getName() + " closing server socket");
  +
  +       try {
  +         if (serverSocket != null) {
  +           serverSocket.close();
  +         }
  +       } catch (Exception e) {
  +         // ignore for now
  +       }
  +
  +       serverSocket = null;
  +     }
  +
  +    /**
  +      * Closes all the connected sockets in the List.
  +      */
  +     private synchronized void closeAllAcceptedSockets() {
  +       for (int x = 0; x < socketList.size(); x++) {
  +         try {
  +           ((Socket) socketList.get(x)).close();
  +         } catch (Exception e) {
  +           // ignore for now
  +         }
  +       }
  +
  +       // clear member variables
  +       socketList.clear();
  +     }
   
     /**
       Loop, accepting new socket connections. */
     public void run() {
  +      /**
  +        * Ensure we start fresh.
  +        */
  +    LogLog.debug("performing socket cleanup prior to entering loop for " + name);
  +    closeServerSocket();
  +    closeAllAcceptedSockets();
  +    LogLog.debug("socket cleanup complete for " + name);       
       active = true;
   
       // start the server socket
  @@ -200,15 +262,19 @@
           "error starting SocketReceiver (" + this.getName()
           + "), receiver did not start", e);
         active = false;
  +      setShutdown(true);
   
         return;
       }
   
  +    Socket socket = null;
  +
       try {
  -      Socket socket = null;
         LogLog.debug("in run-about to enter while isactiveloop");
   
  -      while (isActive()) {
  +      active = true;
  +
  +      while (!rThread.isInterrupted()) {
           // if we have a socket, start watching it
           if (socket != null) {
             LogLog.debug("socket not null - creating and starting socketnode");
  @@ -236,7 +302,16 @@
           "exception while watching socket server in SocketReceiver ("
           + this.getName() + "), stopping", e);
       }
  +  }
   
  -    active = false;
  +  /* (non-Javadoc)
  +   * @see org.apache.log4j.plugins.Receiver#doPost(org.apache.log4j.spi.LoggingEvent)
  +   */
  +  public void doPost(LoggingEvent event) {
  +    if(!isPaused()){
  +      super.doPost(event);
  +    }
     }
  +
  +
   }
  
  
  
  1.41      +13 -2     jakarta-log4j/src/java/org/apache/log4j/spi/LoggingEvent.java
  
  Index: LoggingEvent.java
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/spi/LoggingEvent.java,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- LoggingEvent.java	22 May 2003 08:35:04 -0000	1.40
  +++ LoggingEvent.java	2 Nov 2003 19:53:47 -0000	1.41
  @@ -295,6 +295,14 @@
     }
   
     /**
  +   * Check for the existence of location information without creating it (a byproduct of calling
  +   * getLocationInformation).
  +   */
  +  public boolean locationInformationExists() {
  +    return (locationInfo != null);
  +  }
  +  
  +  /**
      * Set the location information for this logging event. The collected
      * information is cached for future use.
      */
  @@ -566,8 +574,11 @@
       if (properties == null) {
         properties = new Hashtable(5); // create a small hashtable
       }
  -
  -    properties.put(key, value);
  +    if (value != null) { 
  +        properties.put(key, value);        
  +    } else {
  +        properties.remove(key);
  +    }
     }
   
     private void writeObject(ObjectOutputStream oos) throws java.io.IOException {
  
  
  
  1.15      +4 -4      jakarta-log4j/src/java/org/apache/log4j/spi/LocationInfo.java
  
  Index: LocationInfo.java
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/spi/LocationInfo.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- LocationInfo.java	20 May 2003 15:08:08 -0000	1.14
  +++ LocationInfo.java	2 Nov 2003 19:53:47 -0000	1.15
  @@ -214,7 +214,7 @@
        logging request.
     */
     public String getClassName() {
  -    if (!locationInfoAvailable) {
  +    if ((!locationInfoAvailable) || (className == null && fullInfo == null)) {
         return NA;
       }
   
  @@ -259,7 +259,7 @@
        <p>This information is not always available.
     */
     public String getFileName() {
  -    if (!locationInfoAvailable) {
  +    if ((!locationInfoAvailable) || (fileName == null && fullInfo == null)) {
         return NA;
       }
   
  @@ -283,7 +283,7 @@
        <p>This information is not always available.
     */
     public String getLineNumber() {
  -    if (!locationInfoAvailable) {
  +    if ((!locationInfoAvailable) || (lineNumber == null && fullInfo == null)) {
         return NA;
       }
   
  @@ -305,7 +305,7 @@
        Returns the method name of the caller.
     */
     public String getMethodName() {
  -    if (!locationInfoAvailable) {
  +    if ((!locationInfoAvailable) || (methodName == null && fullInfo == null)) {
         return NA;
       }
   
  
  
  
  1.8       +38 -126   jakarta-log4j/src/java/org/apache/log4j/chainsaw/ChainsawAppenderHandler.java
  
  Index: ChainsawAppenderHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/ChainsawAppenderHandler.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ChainsawAppenderHandler.java	22 Sep 2003 06:54:36 -0000	1.7
  +++ ChainsawAppenderHandler.java	2 Nov 2003 19:53:47 -0000	1.8
  @@ -54,7 +54,6 @@
   import org.apache.log4j.helpers.LogLog;
   import org.apache.log4j.net.SocketReceiver;
   import org.apache.log4j.plugins.PluginRegistry;
  -import org.apache.log4j.spi.LocationInfo;
   import org.apache.log4j.spi.LoggingEvent;
   
   import java.beans.PropertyChangeListener;
  @@ -62,12 +61,8 @@
   
   import java.util.ArrayList;
   import java.util.Collection;
  -import java.util.Date;
  -import java.util.HashMap;
   import java.util.Iterator;
   import java.util.List;
  -import java.util.Map;
  -import java.util.Set;
   import java.util.Vector;
   
   import javax.swing.event.EventListenerList;
  @@ -135,97 +130,6 @@
       return false;
     }
   
  -  /**
  -   * Converts a LoggingEvent into a Vector of element (columns really).
  -   * @param event
  -   * @return
  -   *
  -   * @deprecated
  -   */
  -  public static Vector convert(LoggingEvent event) {
  -    Vector v = new Vector();
  -    LocationInfo info = event.getLocationInformation();
  -    String className = "";
  -    String methodName = "";
  -    String fileName = "";
  -    String lineNum = "";
  -
  -    if (info != null) {
  -      try {
  -        className = info.getClassName();
  -        methodName = info.getMethodName();
  -        fileName = info.getFileName();
  -        lineNum = info.getLineNumber();
  -      } catch (NullPointerException npe) {
  -      }
  -
  -      //ignore..malformed info
  -    }
  -
  -    StringBuffer MDC = new StringBuffer();
  -    Set mdc = event.getMDCKeySet();
  -    Iterator iter = mdc.iterator();
  -
  -    while (iter.hasNext()) {
  -      if (MDC.length() != 0) {
  -        MDC.append(",");
  -      }
  -
  -      String propName = (String) iter.next();
  -      MDC.append(propName);
  -      MDC.append("=");
  -
  -      String propValue = (String) event.getMDC(propName);
  -      MDC.append(propValue);
  -    }
  -
  -    StringBuffer prop = new StringBuffer();
  -    Set properties = event.getPropertyKeySet();
  -
  -    if (properties != null) {
  -      Iterator iter2 = properties.iterator();
  -
  -      while (iter2.hasNext()) {
  -        if (prop.length() != 0) {
  -          prop.append(",");
  -        }
  -
  -        String propName = (String) iter2.next();
  -        prop.append(propName);
  -        prop.append("=");
  -
  -        String propValue = (String) event.getProperty(propName);
  -        prop.append(propValue);
  -      }
  -    }
  -
  -    v.add(event.getLoggerName());
  -    v.add(new Date(event.timeStamp));
  -    v.add(event.getLevel().toString());
  -    v.add(event.getThreadName());
  -    v.add(event.getRenderedMessage());
  -    v.add(event.getNDC());
  -    v.add(MDC.toString());
  -
  -    StringBuffer exc = new StringBuffer();
  -    String[] excarray = event.getThrowableStrRep();
  -
  -    if (excarray != null) {
  -      for (int i = 0; i < excarray.length; i++) {
  -        exc.append(excarray[i]);
  -      }
  -    }
  -
  -    v.add(exc.toString());
  -    v.add(className);
  -    v.add(methodName);
  -    v.add(fileName);
  -    v.add(lineNum);
  -    v.add(prop.toString());
  -
  -    return v;
  -  }
  -
     public int getQueueInterval() {
       return sleepInterval;
     }
  @@ -251,9 +155,10 @@
       String appname = e.getProperty(ChainsawConstants.LOG4J_APP_KEY);
   
       if (appname != null) {
  -      if(ident.length()>0){
  -          ident.append("-");
  +      if (ident.length() > 0) {
  +        ident.append("-");
         }
  +
         ident.append(appname);
       }
   
  @@ -378,21 +283,23 @@
      */
     class WorkQueue {
       private final ArrayList queue = new ArrayList();
  -    private boolean stopped = false;
  +    Thread workerThread;
   
       protected WorkQueue() {
  -      new WorkerThread().start();
  +      workerThread = new WorkerThread();
  +      workerThread.start();
       }
   
       public final void enqueue(LoggingEvent event) {
         synchronized (mutex) {
           queue.add(event);
  +        mutex.notify();
         }
       }
   
       public final void stop() {
         synchronized (mutex) {
  -        stopped = true;
  +        workerThread.interrupt();
         }
       }
   
  @@ -409,38 +316,42 @@
         public void run() {
           List innerList = new ArrayList();
   
  -        while (isAlive()) {
  +        while (true) {
             long timeStart = System.currentTimeMillis();
   
             synchronized (mutex) {
  -            if (stopped) {
  -              return;
  -            } else {
  +            try {
  +              while (queue.size() == 0) {
  +                mutex.wait();
  +              }
  +
                 if (queue.size() > 0) {
                   innerList.addAll(queue);
                   queue.clear();
                 }
  +            } catch (InterruptedException ie) {
               }
             }
   
             int size = innerList.size();
   
  -          if (innerList.size() > 0) {
  +          if (size > 0) {
               Iterator iter = innerList.iterator();
  -            Map identifiersEventsMap = new HashMap();
               ChainsawEventBatch eventBatch = new ChainsawEventBatch();
   
               while (iter.hasNext()) {
                 LoggingEvent e = (LoggingEvent) iter.next();
  -              String eventType =
  -                e.getProperty(ChainsawConstants.EVENT_TYPE_KEY);
  -
  -              if (eventType == null) {
  -                eventType = ChainsawConstants.LOG4J_EVENT_TYPE;
  +              Vector properties = new Vector();
  +              Iterator iterx = e.getPropertyKeySet().iterator();
  +              while (iterx.hasNext()) {
  +                  String thisProp = iterx.next().toString();
  +                  properties.add(thisProp +" " + e.getProperty(thisProp));
                 }
  -
  -              String ident = getTabIdentifier(e);
  -              eventBatch.addEvent(ident, eventType, e);
  +              eventBatch.addEvent(
  +                getTabIdentifier(e),
  +                (e.getProperty(ChainsawConstants.EVENT_TYPE_KEY) == null)
  +                ? ChainsawConstants.LOG4J_EVENT_TYPE
  +                : e.getProperty(ChainsawConstants.EVENT_TYPE_KEY), e);
               }
   
               dispatchEventBatch(eventBatch);
  @@ -448,20 +359,21 @@
               innerList.clear();
             }
   
  -
  -
             try {
  -            Thread.sleep(getQueueInterval());
  +            synchronized (this) {
  +              wait(getQueueInterval());
  +            }
             } catch (InterruptedException ie) {
             }
  -		  if (size == 0) {
  -			setDataRate(0.0);
  -		  } else {
  -			long timeEnd = System.currentTimeMillis();
  -			long diffInSeconds = (timeEnd - timeStart)/1000;
  -			double rate = (((double) size) / diffInSeconds);
  -			setDataRate(rate);
  -		  }
  +
  +          if (size == 0) {
  +            setDataRate(0.0);
  +          } else {
  +            long timeEnd = System.currentTimeMillis();
  +            long diffInSeconds = (timeEnd - timeStart) / 1000;
  +            double rate = (((double) size) / diffInSeconds);
  +            setDataRate(rate);
  +          }
           }
         }
   
  
  
  
  1.3       +6 -6      jakarta-log4j/src/java/org/apache/log4j/chainsaw/ColumnComparator.java
  
  Index: ColumnComparator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/ColumnComparator.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ColumnComparator.java	5 Sep 2003 04:17:16 -0000	1.2
  +++ ColumnComparator.java	2 Nov 2003 19:53:47 -0000	1.3
  @@ -100,8 +100,8 @@
         case ChainsawColumns.INDEX_METHOD_COL_NAME:
   
           if (
  -          (e1.getLocationInformation() != null)
  -            & (e2.getLocationInformation() != null)) {
  +          (e1.locationInformationExists())
  +            & (e2.locationInformationExists())) {
             sort =
               e1.getLocationInformation().getMethodName().compareToIgnoreCase(
                 e2.getLocationInformation().getMethodName());
  @@ -112,8 +112,8 @@
         case ChainsawColumns.INDEX_CLASS_COL_NAME:
   
           if (
  -          (e1.getLocationInformation() != null)
  -            & (e2.getLocationInformation() != null)) {
  +          (e1.locationInformationExists())
  +            & (e2.locationInformationExists())) {
             sort =
               e1.getLocationInformation().getClassName().compareToIgnoreCase(
                 e2.getLocationInformation().getClassName());
  @@ -124,8 +124,8 @@
         case ChainsawColumns.INDEX_FILE_COL_NAME:
   
           if (
  -          (e1.getLocationInformation() != null)
  -            & (e2.getLocationInformation() != null)) {
  +          (e1.locationInformationExists())
  +            & (e2.locationInformationExists())) {
             sort =
               e1.getLocationInformation().getFileName().compareToIgnoreCase(
                 e2.getLocationInformation().getFileName());
  
  
  
  1.23      +2 -2      jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogPanel.java
  
  Index: LogPanel.java
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogPanel.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- LogPanel.java	29 Oct 2003 08:50:37 -0000	1.22
  +++ LogPanel.java	2 Nov 2003 19:53:47 -0000	1.23
  @@ -253,7 +253,7 @@
             boolean newValue = ((Boolean) evt.getNewValue()).booleanValue();
   
             if (newValue) {
  -            lowerPanel.setDividerLocation(150);
  +            lowerPanel.setDividerLocation(400);
             }
   
             detailPanel.setVisible(newValue);
  @@ -904,7 +904,7 @@
         new JSplitPane(
           JSplitPane.VERTICAL_SPLIT, eventsAndStatusPanel, detailPanel);
       lowerPanel.setBorder(null);
  -    lowerPanel.setDividerLocation(150);
  +    lowerPanel.setDividerLocation(400);
       lowerPanel.setLastDividerLocation(-1);
       lowerPanel.setOneTouchExpandable(true);
   
  
  
  
  1.3       +1 -1      jakarta-log4j/src/java/org/apache/log4j/chainsaw/FileLoadAction.java
  
  Index: FileLoadAction.java
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/FileLoadAction.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- FileLoadAction.java	2 Sep 2003 01:07:00 -0000	1.2
  +++ FileLoadAction.java	2 Nov 2003 19:53:47 -0000	1.3
  @@ -135,7 +135,7 @@
       chooser.setFileFilter(
         new FileFilter() {
           public boolean accept(File f) {
  -          return f.getName().toLowerCase().endsWith(".xml");
  +          return (f.getName().toLowerCase().endsWith(".xml")|| f.isDirectory());
           }
   
           public String getDescription() {
  
  
  
  1.13      +11 -1     jakarta-log4j/src/java/org/apache/log4j/chainsaw/ReceiversPanel.java
  
  Index: ReceiversPanel.java
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/ReceiversPanel.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- ReceiversPanel.java	18 Sep 2003 04:05:05 -0000	1.12
  +++ ReceiversPanel.java	2 Nov 2003 19:53:47 -0000	1.13
  @@ -123,6 +123,7 @@
   import org.apache.log4j.net.SocketReceiver;
   import org.apache.log4j.net.UDPAppender;
   import org.apache.log4j.net.UDPReceiver;
  +import org.apache.log4j.net.XMLSocketReceiver;
   import org.apache.log4j.plugins.Pauseable;
   import org.apache.log4j.plugins.PluginRegistry;
   import org.apache.log4j.plugins.Receiver;
  @@ -664,6 +665,13 @@
             new SimplePortBasedReceiverDialogPanel(
               UDPReceiver.class, "UDPReceiver", UDPAppender.DEFAULT_PORT)));
   
  +        dialogMap.put(
  +          XMLSocketReceiver.class,
  +          new CreateReceiverDialog(
  +            XMLSocketReceiver.class, "XMLSocketReceiver", "XML Socket Receiver (log4j.dtd)",
  +            new SimplePortBasedReceiverDialogPanel(
  +              XMLSocketReceiver.class, "XMLSocketReceiver", XMLSocketReceiver.DEFAULT_PORT)));
  +
         List dialogMapEntryList = new ArrayList();
   
         for (Iterator iter = dialogMap.entrySet().iterator(); iter.hasNext();) {
  @@ -715,8 +723,10 @@
   
         if (userObject == getRootOfTree().getUserObject()) {
           buildForReceiversRoot();
  -      } else {
  +      } else if (getCurrentlySelectedReceiver() != null) {
           buildForReceiverNode();
  +      } else {
  +          return;
         }
   
         this.invalidate();
  
  
  
  1.12      +9 -5      jakarta-log4j/src/java/org/apache/log4j/chainsaw/LoggingEventFieldResolver.java
  
  Index: LoggingEventFieldResolver.java
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/LoggingEventFieldResolver.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- LoggingEventFieldResolver.java	30 Oct 2003 08:10:27 -0000	1.11
  +++ LoggingEventFieldResolver.java	2 Nov 2003 19:53:47 -0000	1.12
  @@ -49,6 +49,7 @@
   
   package org.apache.log4j.chainsaw;
   
  +import org.apache.log4j.spi.LocationInfo;
   import org.apache.log4j.spi.LoggingEvent;
   
   import java.util.ArrayList;
  @@ -139,19 +140,22 @@
   
     public Object getValue(String fieldName, LoggingEvent event) {
       String upperField = fieldName.toUpperCase();
  -
  +    LocationInfo info = null;
  +    if (event.locationInformationExists()) {
  +        info = event.getLocationInformation();
  +    }
       if (LOGGER_FIELD.equals(upperField)) {
         return event.getLoggerName();
       } else if (LEVEL_FIELD.equals(upperField)) {
         return event.getLevel();
       } else if (CLASS_FIELD.equals(upperField)) {
  -      return event.getLocationInformation().getClassName();
  +      return ((info == null) ? "" : info.getClassName());
       } else if (FILE_FIELD.equals(upperField)) {
  -      return event.getLocationInformation().getFileName();
  +      return ((info == null) ? "" : info.getFileName());
       } else if (LINE_FIELD.equals(upperField)) {
  -      return event.getLocationInformation().getLineNumber();
  +      return ((info == null) ? "" : info.getLineNumber());
       } else if (METHOD_FIELD.equals(upperField)) {
  -      return event.getLocationInformation().getMethodName();
  +      return ((info == null) ? "" : info.getMethodName());
       } else if (MSG_FIELD.equals(upperField)) {
         return event.getMessage();
       } else if (NDC_FIELD.equals(upperField)) {
  
  
  
  1.11      +22 -12    jakarta-log4j/src/java/org/apache/log4j/chainsaw/ChainsawCyclicBufferTableModel.java
  
  Index: ChainsawCyclicBufferTableModel.java
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/ChainsawCyclicBufferTableModel.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- ChainsawCyclicBufferTableModel.java	19 Sep 2003 03:55:23 -0000	1.10
  +++ ChainsawCyclicBufferTableModel.java	2 Nov 2003 19:53:47 -0000	1.11
  @@ -90,9 +90,11 @@
   class ChainsawCyclicBufferTableModel extends AbstractTableModel
     implements EventContainer, PropertyChangeListener {
     private boolean cyclic = true;
  -  private final int INITIAL_CAPACITY = 5000;
  -  List unfilteredList = new CyclicBufferList(INITIAL_CAPACITY);
  -  List filteredList = new CyclicBufferList(INITIAL_CAPACITY);
  +  private final int DEFAULT_CAPACITY = 5000;
  +  private int capacity = DEFAULT_CAPACITY;
  +  private static final String PANEL_CAPACITY = "CHAINSAW_CAPACITY";
  +  List unfilteredList = new CyclicBufferList(capacity);
  +  List filteredList = new CyclicBufferList(capacity);
     private boolean currentSortAscending;
     private int currentSortColumn;
     private EventListenerList eventListenerList = new EventListenerList();
  @@ -115,6 +117,11 @@
   
     public ChainsawCyclicBufferTableModel() {
       propertySupport.addPropertyChangeListener("cyclic", new ModelChanger());
  +    if (System.getProperty(PANEL_CAPACITY) != null) {
  +        try {
  +            capacity = Integer.parseInt(System.getProperty(PANEL_CAPACITY));
  +        } catch (NumberFormatException nfe) {}
  +    }
     }
   
     /**
  @@ -330,7 +337,10 @@
         return null;
       }
   
  -    LocationInfo info = event.getLocationInformation();
  +    LocationInfo info = null;
  +    if (event.locationInformationExists()) {
  +        info = event.getLocationInformation();
  +    }
   
       if (event == null) {
         LogLog.error("Invalid rowindex=" + rowIndex);
  @@ -376,16 +386,16 @@
         return event.getThrowableStrRep();
   
       case ChainsawColumns.INDEX_CLASS_COL_NAME:
  -      return (info != null) ? info.getClassName() : "";
  +      return (info == null) ?  "" : info.getClassName();
   
       case ChainsawColumns.INDEX_FILE_COL_NAME:
  -      return (info != null) ? info.getFileName() : "";
  +      return (info == null) ? "" : info.getFileName();
   
       case ChainsawColumns.INDEX_LINE_COL_NAME:
  -      return (info != null) ? info.getLineNumber() : "";
  +      return (info == null) ? "" : info.getLineNumber();
   
       case ChainsawColumns.INDEX_METHOD_COL_NAME:
  -      return (info != null) ? info.getMethodName() : "";
  +      return (info == null) ? "" : info.getMethodName();
   
       default:
   
  @@ -594,9 +604,9 @@
           List newFilteredList = null;
   
           if (isCyclic()) {
  -          newFilteredList = new CyclicBufferList(INITIAL_CAPACITY);
  +          newFilteredList = new CyclicBufferList(capacity);
           } else {
  -          newFilteredList = new ArrayList(INITIAL_CAPACITY);
  +          newFilteredList = new ArrayList(capacity);
           }
   
           synchronized (unfilteredList) {
  @@ -669,9 +679,9 @@
                     List newUnfilteredList = null;
   
                     if (isCyclic()) {
  -                    newUnfilteredList = new CyclicBufferList(INITIAL_CAPACITY);
  +                    newUnfilteredList = new CyclicBufferList(capacity);
                     } else {
  -                    newUnfilteredList = new ArrayList(INITIAL_CAPACITY);
  +                    newUnfilteredList = new ArrayList(capacity);
                     }
   
                     for (Iterator iter = unfilteredList.iterator();
  
  
  
  1.3       +0 -15     jakarta-log4j/src/java/org/apache/log4j/chainsaw/ChainsawEventBatchEntry.java
  
  Index: ChainsawEventBatchEntry.java
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/ChainsawEventBatchEntry.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ChainsawEventBatchEntry.java	3 Sep 2003 00:39:29 -0000	1.2
  +++ ChainsawEventBatchEntry.java	2 Nov 2003 19:53:47 -0000	1.3
  @@ -57,9 +57,6 @@
   
   import org.apache.log4j.spi.LoggingEvent;
   
  -import java.util.Vector;
  -
  -
   /**
    * A simple container of Events, mapped to an identifier
    * @author Paul Smith <ps...@apache.org>
  @@ -80,18 +77,6 @@
   
     String getEventType() {
       return eventType;
  -  }
  -
  -  /**
  -   * @deprecated
  -   * @return
  -   */
  -  Vector getEventVector() {
  -    return ChainsawAppenderHandler.convert(getEvent());
  -//    throw new UnsupportedOperationException(
  -//      "Transistion to non Vector based model");
  -
  -    //    return eventVector;
     }
   
     public LoggingEvent getEvent() {
  
  
  
  1.5       +8 -6      jakarta-log4j/src/java/org/apache/log4j/chainsaw/ReceiversTreeModel.java
  
  Index: ReceiversTreeModel.java
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/ReceiversTreeModel.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ReceiversTreeModel.java	18 Sep 2003 04:05:05 -0000	1.4
  +++ ReceiversTreeModel.java	2 Nov 2003 19:53:47 -0000	1.5
  @@ -173,16 +173,18 @@
         Receiver receiver = (Receiver) e.getPlugin();
         DefaultMutableTreeNode node =
           (DefaultMutableTreeNode) resolvePluginNode(receiver);
  -      int index = getRootNode().getIndex(node);
  -      getRootNode().remove(node);
  -      nodesWereRemoved(
  -        getRootNode(), new int[] { index }, new Object[] { node });
  -      pluginNodeMap.remove(receiver);
  +        if (node != null) {
  +            int index = getRootNode().getIndex(node);
  +            getRootNode().remove(node);
  +            nodesWereRemoved(
  +                getRootNode(), new int[] { index }, new Object[] { node });
  +            pluginNodeMap.remove(receiver);
  +        }
   
         if (getRootNode().getChildCount() == 0) {
           getRootNode().add(NoReceiversNode);
   
  -        index = getRootNode().getIndex(NoReceiversNode);
  +        int index = getRootNode().getIndex(NoReceiversNode);
           nodesWereInserted(getRootNode(), new int[] { index });
         }
       }
  
  
  
  1.1                  jakarta-log4j/src/java/org/apache/log4j/chainsaw/Details_XMLSocketReceiver.html
  
  Index: Details_XMLSocketReceiver.html
  ===================================================================
  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
  <html>
  <Head><link rel="stylesheet" href="stylesheet.css" type="text/css"></head>
  <body>
  <B>XML Socket Receiver</b>
  <p>XMLSocketReceiver compliments externally provided SocketAppenders. <br>
  XMLSocketReceiver supports Log4J's log4j.dtd and Java 1.4's logger.dtd.<br>
  However, only Log4J's log4j.dtd is currently supported when defining the receiver 
  through this panel.
  </p>
  
  <p>XMLSocketReceiver listens
  on a specified port, accepting connections from remote sockets
  , converts the XML into logging events received from these sockets,
  and posts them into Chainsaw's local Log4j environment allowing you 
  to view them.</p>
  <p>Click here to see more information about XMLSocketReceiver.</p>
  
  <p>Click <a href="http://jakarta.apache.org/log4j/docs/api/org/apache/log4j/net/XMLSocketAppender.html">here</a> to see more information about SocketAppender.</p>
  </body>
  </html>
  
  
  1.80      +3 -1      jakarta-log4j/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/build.xml,v
  retrieving revision 1.79
  retrieving revision 1.80
  diff -u -r1.79 -r1.80
  --- build.xml	27 Oct 2003 22:15:23 -0000	1.79
  +++ build.xml	2 Nov 2003 19:53:48 -0000	1.80
  @@ -260,6 +260,8 @@
       </javac>
       <copy file="${BSTEM}/xml/log4j.dtd"
       tofile="${javac.dest}/${stem}/xml/log4j.dtd" />
  +    <copy file="${BSTEM}/xml/logger.dtd"
  +    tofile="${javac.dest}/${stem}/xml/logger.dtd" />
     </target>
   
     <target name="build.avalonFramework" depends="init, avalonFramework" if="avalonFramework-present">
  @@ -446,7 +448,7 @@
       </delete>
   
       <jar jarfile="${jar.dest}/${log4j.jar}" basedir="${javac.dest}"
  -      includes="${stem}/*.class, ${stem}/xml/log4j.dtd,
  +      includes="${stem}/*.class, ${stem}/xml/log4j.dtd, ${stem}/xml/logger.dtd,
                   org/apache/joran/**/*.class,
                   ${stem}/joran/**/*.class,
                   ${stem}/config/*.class,
  
  
  
  1.2       +8 -8      jakarta-log4j/src/java/org/apache/log4j/UtilLoggingLevel.java
  
  Index: UtilLoggingLevel.java
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/UtilLoggingLevel.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- UtilLoggingLevel.java	24 Jun 2003 08:15:23 -0000	1.1
  +++ UtilLoggingLevel.java	2 Nov 2003 19:53:48 -0000	1.2
  @@ -62,14 +62,14 @@
   
   public class UtilLoggingLevel extends Level {
   
  -  public static final int SEVERE_INT = 1000;
  -  public static final int WARNING_INT = 900;
  -  public static final int INFO_INT = 800;
  -  public static final int CONFIG_INT = 700;
  -  public static final int FINE_INT = 500;
  -  public static final int FINER_INT = 400;
  -  public static final int FINEST_INT = 300;
  -  public static final int UNKNOWN_INT = 200;
  +  public static final int SEVERE_INT = 17000;
  +  public static final int WARNING_INT = 16000;
  +  public static final int INFO_INT = 15000;
  +  public static final int CONFIG_INT = 14000;
  +  public static final int FINE_INT = 13000;
  +  public static final int FINER_INT = 12000;
  +  public static final int FINEST_INT = 11000;
  +  public static final int UNKNOWN_INT = 10000;
     
     public static final UtilLoggingLevel SEVERE = new UtilLoggingLevel(SEVERE_INT, "SEVERE", 0);
     public static final UtilLoggingLevel WARNING = new UtilLoggingLevel(WARNING_INT, "WARNING", 4);
  
  
  
  1.4       +4 -1      jakarta-log4j/src/java/org/apache/log4j/chainsaw/layout/EventDetailLayout.java
  
  Index: EventDetailLayout.java
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/layout/EventDetailLayout.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- EventDetailLayout.java	15 Sep 2003 23:25:58 -0000	1.3
  +++ EventDetailLayout.java	2 Nov 2003 19:53:48 -0000	1.4
  @@ -219,7 +219,10 @@
       String ndc = event.getNDC();
       Hashtable mdc = formatMDC(event);
       String[] throwableStringRep = event.getThrowableStrRep();
  -    LocationInfo li = formatLocationInfo(event);
  +    LocationInfo li = null;
  +    if (event.locationInformationExists()) {
  +        formatLocationInfo(event);
  +    }
       Hashtable properties = formatProperties(event);
       LoggingEvent copy =
         new LoggingEvent(
  
  
  
  1.3       +5 -3      jakarta-log4j/src/java/org/apache/log4j/xml/UtilLoggingXMLDecoder.java
  
  Index: UtilLoggingXMLDecoder.java
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/xml/UtilLoggingXMLDecoder.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- UtilLoggingXMLDecoder.java	11 Jul 2003 04:52:52 -0000	1.2
  +++ UtilLoggingXMLDecoder.java	2 Nov 2003 19:53:48 -0000	1.3
  @@ -402,15 +402,17 @@
             properties.putAll(additionalProperties);
           }
         }
  -
  +      LocationInfo info = null;
  +      if ((fileName != null) || (className != null) || (methodName != null) || (lineNumber != null)) {
  +          info = new LocationInfo(fileName, className, methodName, lineNumber);
  +      } 
         events.add(
           new LoggingEvent(
             logger.getName(), logger, timeStamp, level, threadName, message, ndc,
             mdc, exception,
  -          new LocationInfo(fileName, className, methodName, lineNumber),
  +          info,
             properties));
       }
  -
       return events;
     }
   
  
  
  
  1.4       +5 -3      jakarta-log4j/src/java/org/apache/log4j/xml/XMLDecoder.java
  
  Index: XMLDecoder.java
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/xml/XMLDecoder.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- XMLDecoder.java	10 Aug 2003 13:54:15 -0000	1.3
  +++ XMLDecoder.java	2 Nov 2003 19:53:48 -0000	1.4
  @@ -237,7 +237,6 @@
   			newDoc=partialEvent + newDoc;
   		}	      		
         	partialEvent=newPartialEvent;
  -      	
           Document doc = parse(newDoc);
           if (doc == null) {
             return null;
  @@ -407,12 +406,15 @@
         if (levelImpl==null) {
         	levelImpl=Level.toLevel(level);
         }
  -      		
  +      LocationInfo info = null;
  +      if ((fileName != null) || (className != null) || (methodName != null) || (lineNumber != null)) {
  +          info = new LocationInfo(fileName, className, methodName, lineNumber);
  +      } 
         events.add(
           new LoggingEvent(
             logger.getName(), logger, timeStamp, levelImpl, threadName, message, ndc,
             mdc, exception,
  -          new LocationInfo(fileName, className, methodName, lineNumber),
  +          info,
             properties));
       }
   
  
  
  
  1.4       +1 -1      jakarta-log4j/src/java/org/apache/log4j/chainsaw/filter/FilterModel.java
  
  Index: FilterModel.java
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/filter/FilterModel.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- FilterModel.java	29 Oct 2003 08:50:36 -0000	1.3
  +++ FilterModel.java	2 Nov 2003 19:53:48 -0000	1.4
  @@ -77,7 +77,7 @@
       container.addNDC(event.getNDC());
       container.addMDCKeys(event.getMDCKeySet());
   
  -    if (event.getLocationInformation() != null) {
  +    if (event.locationInformationExists()) {
         LocationInfo info = event.getLocationInformation();
         container.addClass(info.getClassName());
         container.addMethod(info.getMethodName());
  
  
  
  1.15      +1 -0      jakarta-log4j/src/java/org/apache/log4j/chainsaw/rule/RuleTest.java
  
  Index: RuleTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/rule/RuleTest.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- RuleTest.java	31 Oct 2003 08:29:53 -0000	1.14
  +++ RuleTest.java	2 Nov 2003 19:53:48 -0000	1.15
  @@ -233,6 +233,7 @@
       String lastField = null;
       JPopupMenu contextMenu = new JPopupMenu();
       JList list = new JList();
  + 
       JScrollPane scrollPane = new JScrollPane(list);
       final JTextField textField;
       private DefaultListModel fieldModel = new DefaultListModel();
  
  
  

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