logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sde...@apache.org
Subject cvs commit: logging-log4j/src/java/org/apache/log4j/chainsaw/plugins ChainsawCentral.java
Date Mon, 05 Jan 2004 04:37:33 GMT
sdeboy      2004/01/04 20:37:33

  Modified:    src/java/org/apache/log4j/chainsaw LogUI.java
                        ChainsawAppender.java ChainsawAppenderHandler.java
               src/java/org/apache/log4j/chainsaw/plugins
                        ChainsawCentral.java
  Log:
  Modified ChainsawAppender to support only one appender, now ChainsawAppender is being added
as an appender when specified, instead of ChainsawAppenderHandler
  
  Revision  Changes    Path
  1.72      +1 -1      logging-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java
  
  Index: LogUI.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java,v
  retrieving revision 1.71
  retrieving revision 1.72
  diff -u -r1.71 -r1.72
  --- LogUI.java	3 Jan 2004 08:04:12 -0000	1.71
  +++ LogUI.java	5 Jan 2004 04:37:33 -0000	1.72
  @@ -321,7 +321,7 @@
       
         handler = new ChainsawAppenderHandler(appender);
         handler.addEventBatchListener(new NewTabEventBatchReceiver());
  -      LogManager.getRootLogger().addAppender(handler);
  +      LogManager.getRootLogger().addAppender(appender);
         setShutdownAction(new AbstractAction() {
   		public void actionPerformed(ActionEvent e) {
   		}});
  
  
  
  1.9       +9 -10     logging-log4j/src/java/org/apache/log4j/chainsaw/ChainsawAppender.java
  
  Index: ChainsawAppender.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/chainsaw/ChainsawAppender.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ChainsawAppender.java	3 Jan 2004 08:04:12 -0000	1.8
  +++ ChainsawAppender.java	5 Jan 2004 04:37:33 -0000	1.9
  @@ -50,7 +50,6 @@
   
   import java.net.InetAddress;
   import java.net.UnknownHostException;
  -import java.util.ArrayList;
   
   import org.apache.log4j.Appender;
   import org.apache.log4j.AppenderSkeleton;
  @@ -69,7 +68,7 @@
   public class ChainsawAppender
       extends AppenderSkeleton{
   
  -  private final ArrayList appenders=new ArrayList();
  +  private Appender appender;
     
     /**
      * The in-JVM singleton instance of the ChainsawAppender.
  @@ -114,13 +113,17 @@
     public boolean requiresLayout() {
       return false;
     }
  +  
  +  public Appender getAppender() {
  +      return appender;
  +  } 
   
  -  public void addAppender(Appender appender) {
  -    appenders.add(appender);
  +  public void setAppender(Appender appender) {
  +    this.appender = appender;
     }
     
     /**
  -   * Appends the event into the internal wrapped TableModel
  +   * Appends the event
      * @param aEvent the LoggingEvent to append
      */
     protected void append(LoggingEvent aEvent) {
  @@ -132,10 +135,7 @@
           aEvent.setProperty(Constants.APPLICATION_KEY, application);
         }
   
  -      for (int i=0;i<appenders.size();i++) {
  -        Appender appender=(Appender)appenders.get(i);
  -        appender.doAppend(aEvent);
  -      }
  +      appender.doAppend(aEvent);
     }
   
     /**
  @@ -168,7 +168,6 @@
      * Close does nothing
      */
     public void close() {
  -    /** @todo  perhaps it should clear the internal TableModel */
     }
   
     /**
  
  
  
  1.14      +1 -1      logging-log4j/src/java/org/apache/log4j/chainsaw/ChainsawAppenderHandler.java
  
  Index: ChainsawAppenderHandler.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/chainsaw/ChainsawAppenderHandler.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- ChainsawAppenderHandler.java	31 Dec 2003 09:54:40 -0000	1.13
  +++ ChainsawAppenderHandler.java	5 Jan 2004 04:37:33 -0000	1.14
  @@ -91,7 +91,7 @@
       new PropertyChangeSupport(this);
   
     public ChainsawAppenderHandler(ChainsawAppender appender) {
  -    appender.addAppender(this);
  +    appender.setAppender(this);
       activateOptions();
     }
   
  
  
  
  1.2       +13 -8     logging-log4j/src/java/org/apache/log4j/chainsaw/plugins/ChainsawCentral.java
  
  Index: ChainsawCentral.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/chainsaw/plugins/ChainsawCentral.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ChainsawCentral.java	31 Dec 2003 07:00:11 -0000	1.1
  +++ ChainsawCentral.java	5 Jan 2004 04:37:33 -0000	1.2
  @@ -49,20 +49,12 @@
   
   package org.apache.log4j.chainsaw.plugins;
   
  -import org.apache.log4j.Appender;
  -import org.apache.log4j.chainsaw.ChainsawAppenderHandler;
  -import org.apache.log4j.chainsaw.messages.MessageCenter;
  -import org.apache.log4j.helpers.LogLog;
  -
   import java.awt.BorderLayout;
   import java.awt.Color;
   import java.awt.GridLayout;
  -
   import java.beans.PropertyChangeEvent;
   import java.beans.PropertyChangeListener;
  -
   import java.text.NumberFormat;
  -
   import java.util.Enumeration;
   import java.util.LinkedList;
   
  @@ -72,6 +64,12 @@
   import javax.swing.JPanel;
   import javax.swing.SwingUtilities;
   
  +import org.apache.log4j.Appender;
  +import org.apache.log4j.chainsaw.ChainsawAppender;
  +import org.apache.log4j.chainsaw.ChainsawAppenderHandler;
  +import org.apache.log4j.chainsaw.messages.MessageCenter;
  +import org.apache.log4j.helpers.LogLog;
  +
   
   /**
    * @author Paul Smith <psmith@apache.org>
  @@ -112,6 +110,13 @@
           this.handler = (ChainsawAppenderHandler) appender;
   
           break;
  +      }
  +      if (appender instanceof ChainsawAppender) {
  +          Appender chainsawAppender = ((ChainsawAppender)appender).getAppender();
  +          if (chainsawAppender instanceof ChainsawAppenderHandler) {
  +              handler = (ChainsawAppenderHandler)chainsawAppender;
  +              break;
  +          }
         }
       }
   
  
  
  

---------------------------------------------------------------------
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