logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject cvs commit: logging-log4j/src/java/org/apache/log4j/joran JoranConfigurator.java
Date Thu, 06 Jan 2005 19:27:04 GMT
ceki        2005/01/06 11:27:04

  Modified:    tests/src/java/org/apache/log4j/rolling/helper
                        CompressTestCase.java
               src/java/org/apache/log4j/rolling/helper
                        FileNamePattern.java RollingCalendar.java
                        Compress.java
               src/java/org/apache/log4j/selector/servlet
                        ContextDetachingSCL.java
               src/java/org/apache/log4j/rolling
                        FixedWindowRollingPolicy.java
                        TimeBasedRollingPolicy.java
               src/java/org/apache/log4j/db DBReceiver.java
                        DBReceiverJob.java
               src/java/org/apache/joran/action ParamAction.java
                        NewRuleAction.java
               src/java/org/apache/log4j/pattern NamedPatternConverter.java
                        DatePatternConverter.java
               src/java/org/apache/log4j/net SocketHubAppender.java
                        TelnetAppender.java SocketHubReceiver.java
                        XMLSocketReceiver.java JMSReceiver.java
                        SocketNode.java XMLSocketNode.java
               src/java/org/apache/joran Interpreter.java
               src/java/org/apache/log4j/xml DOMConfigurator.java
               src/java/org/apache/log4j/joran JoranConfigurator.java
  Log:
  Removed all members fields of type Logger in accordance with the internal logging guidelines.
  
  Revision  Changes    Path
  1.2       +5 -3      logging-log4j/tests/src/java/org/apache/log4j/rolling/helper/CompressTestCase.java
  
  Index: CompressTestCase.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/tests/src/java/org/apache/log4j/rolling/helper/CompressTestCase.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CompressTestCase.java	23 Nov 2004 18:50:12 -0000	1.1
  +++ CompressTestCase.java	6 Jan 2005 19:27:03 -0000	1.2
  @@ -30,6 +30,8 @@
    */
   public class CompressTestCase extends TestCase {
   
  +  Compress compress = new Compress();
  +  
     /**
      * Constructor for CompressTestCase.
      * @param arg0
  @@ -47,19 +49,19 @@
     }
     
     public void test1() throws Exception {
  -    Compress.GZCompress("input/compress1.txt", "output/compress1.txt.gz");   
  +    compress.GZCompress("input/compress1.txt", "output/compress1.txt.gz");   
       assertTrue(Compare.gzCompare("output/compress1.txt.gz",
              "witness/compress1.txt.gz"));  
     }
     
     public void test2() throws Exception {
  -     Compress.GZCompress("input/compress2.txt", "output/compress2.txt");   
  +     compress.GZCompress("input/compress2.txt", "output/compress2.txt");   
        assertTrue(Compare.gzCompare("output/compress2.txt.gz",
               "witness/compress2.txt.gz"));  
      }
      
     public void test3() throws Exception {
  -      Compress.ZIPCompress("input/compress3.txt", "output/compress3.txt");   
  +      compress.ZIPCompress("input/compress3.txt", "output/compress3.txt");   
         //assertTrue(Compare.compare("output/compress3.txt.zip",
           //     "witness/compress3.txt.zip"));  
       }
  
  
  
  1.6       +6 -7      logging-log4j/src/java/org/apache/log4j/rolling/helper/FileNamePattern.java
  
  Index: FileNamePattern.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/rolling/helper/FileNamePattern.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- FileNamePattern.java	16 Dec 2004 21:09:21 -0000	1.5
  +++ FileNamePattern.java	6 Jan 2005 19:27:03 -0000	1.6
  @@ -16,10 +16,10 @@
   
   package org.apache.log4j.rolling.helper;
   
  -import org.apache.log4j.Logger;
  -
   import java.util.Date;
   
  +import org.apache.log4j.spi.ComponentBase;
  +
   
   /**
    *
  @@ -29,8 +29,7 @@
    * @author Ceki Gülcü
    *
    */
  -public class FileNamePattern {
  -  Logger logger = Logger.getLogger(FileNamePattern.class);
  +public class FileNamePattern extends ComponentBase {
     String pattern;
     int patternLength;
     TokenConverter headTokenConverter;
  @@ -106,7 +105,7 @@
               option = pattern.substring(i + 3, optionEnd);
               lastIndex = optionEnd + 1;
             } else {
  -            logger.debug("Assuming daily rotation schedule");
  +            getLogger().debug("Assuming daily rotation schedule");
               option = "yyyy-MM-dd";
               lastIndex = i+2;
             }
  @@ -203,7 +202,7 @@
           break;
   
         default:
  -        logger.error(
  +        getLogger().error(
             "Encountered an unknown TokenConverter type for pattern [" + pattern
             + "].");
         }
  @@ -231,7 +230,7 @@
           break;
   
         default:
  -        logger.error(
  +        getLogger().error(
             "Encountered an unknown TokenConverter type for pattern [" + pattern
             + "].");
         }
  
  
  
  1.3       +2 -3      logging-log4j/src/java/org/apache/log4j/rolling/helper/RollingCalendar.java
  
  Index: RollingCalendar.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/rolling/helper/RollingCalendar.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RollingCalendar.java	23 Nov 2004 20:38:33 -0000	1.2
  +++ RollingCalendar.java	6 Jan 2005 19:27:03 -0000	1.3
  @@ -16,7 +16,7 @@
   
   package org.apache.log4j.rolling.helper;
   
  -import org.apache.log4j.Logger;
  +import org.apache.ugli.ULogger;
   
   import java.text.SimpleDateFormat;
   
  @@ -38,7 +38,6 @@
    *
    * */
   public class RollingCalendar extends GregorianCalendar {
  -  final Logger logger = Logger.getLogger(RollingCalendar.class);
   
     // The gmtTimeZone is used only in computeCheckPeriod() method.
     static final TimeZone GMT_TIMEZONE = TimeZone.getTimeZone("GMT");
  @@ -111,7 +110,7 @@
       return TOP_OF_TROUBLE; // Deliberately head for trouble...
     }
   
  -  public void printPeriodicity() {
  +  public void printPeriodicity(ULogger logger) {
       switch (type) {
       case TOP_OF_SECOND:
         logger.debug("Rollover every second.");
  
  
  
  1.2       +15 -16    logging-log4j/src/java/org/apache/log4j/rolling/helper/Compress.java
  
  Index: Compress.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/rolling/helper/Compress.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Compress.java	23 Nov 2004 18:48:37 -0000	1.1
  +++ Compress.java	6 Jan 2005 19:27:03 -0000	1.2
  @@ -16,14 +16,14 @@
   
   package org.apache.log4j.rolling.helper;
   
  -import org.apache.log4j.Logger;
  -
   import java.io.*;
   
   import java.util.zip.GZIPOutputStream;
   import java.util.zip.ZipEntry;
   import java.util.zip.ZipOutputStream;
   
  +import org.apache.log4j.spi.ComponentBase;
  +
   
   /**
    * The <code>Compression</code> class implements ZIP and GZ
  @@ -32,8 +32,7 @@
    * @author Ceki G&uuml;lc&uuml;
    * @since 1.3
    */
  -public class Compress {
  -  static final Logger logger = Logger.getLogger(Compress.class);
  +public class Compress extends ComponentBase {
     public static final int NONE = 0;
     public static final int GZ = 1;
     public static final int ZIP = 2;
  @@ -55,18 +54,18 @@
      */
     public static final String ZIP_STR = "ZIP";
   
  -  public static void ZIPCompress(String nameOfFile2zip) {
  +  public void ZIPCompress(String nameOfFile2zip) {
       // Here we rely on the fact that the two argument version of ZIPCompress 
       // automaticallys add a .zip extension to the second argument 
       GZCompress(nameOfFile2zip, nameOfFile2zip);
     }
     
  -  public static void ZIPCompress(
  +  public void ZIPCompress(
       String nameOfFile2zip, String nameOfZippedFile) {
       File file2zip = new File(nameOfFile2zip);
   
       if (!file2zip.exists()) {
  -      logger.warn(
  +      getLogger().warn(
           "The file to compress named [" + nameOfFile2zip + "] does not exist.");
   
         return;
  @@ -79,7 +78,7 @@
       File zippedFile = new File(nameOfZippedFile);
   
       if (zippedFile.exists()) {
  -      logger.warn(
  +      getLogger().warn(
           "The target compressed file named [" + nameOfZippedFile
           + "] exist already.");
   
  @@ -105,26 +104,26 @@
         zos.close();
   
         if (!file2zip.delete()) {
  -        logger.warn("Could not delete [" + nameOfFile2zip + "].");
  +        getLogger().warn("Could not delete [" + nameOfFile2zip + "].");
         }
       } catch (Exception e) {
  -      logger.error(
  +      getLogger().error(
           "Error occured while compressing [" + nameOfFile2zip + "] into ["
           + nameOfZippedFile + "].", e);
       }
     }
   
  -  public static void GZCompress(String nameOfFile2gz) {
  +  public void GZCompress(String nameOfFile2gz) {
       // Here we rely on the fact that the two argument version of GZCompress 
       // automatically adds a .gz extension to the second argument 
       GZCompress(nameOfFile2gz, nameOfFile2gz);
     }
   
  -  public static void GZCompress(String nameOfFile2gz, String nameOfgzedFile) {
  +  public void GZCompress(String nameOfFile2gz, String nameOfgzedFile) {
       File file2gz = new File(nameOfFile2gz);
   
       if (!file2gz.exists()) {
  -      logger.warn(
  +      getLogger().warn(
           "The file to compress named [" + nameOfFile2gz + "] does not exist.");
   
         return;
  @@ -137,7 +136,7 @@
       File gzedFile = new File(nameOfgzedFile);
   
       if (gzedFile.exists()) {
  -      logger.warn(
  +      getLogger().warn(
           "The target compressed file named [" + nameOfgzedFile
           + "] exist already.");
   
  @@ -159,10 +158,10 @@
         gzos.close();
   
         if (!file2gz.delete()) {
  -        logger.warn("Could not delete [" + nameOfFile2gz + "].");
  +        getLogger().warn("Could not delete [" + nameOfFile2gz + "].");
         }
       } catch (Exception e) {
  -      logger.error(
  +      getLogger().error(
           "Error occured while compressing [" + nameOfFile2gz + "] into ["
           + nameOfgzedFile + "].", e);
       }
  
  
  
  1.2       +11 -8     logging-log4j/src/java/org/apache/log4j/selector/servlet/ContextDetachingSCL.java
  
  Index: ContextDetachingSCL.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/selector/servlet/ContextDetachingSCL.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ContextDetachingSCL.java	30 Mar 2004 10:45:21 -0000	1.1
  +++ ContextDetachingSCL.java	6 Jan 2005 19:27:03 -0000	1.2
  @@ -26,26 +26,29 @@
   import javax.naming.Context;
   import javax.naming.NamingException;
   
  -import javax.servlet.ServletContext;
   import javax.servlet.ServletContextEvent;
   import javax.servlet.ServletContextListener;
   
  +// WARNING
  +// WARNING Since ServletContextListeners get instantiated by the application
  +// WARNING server, we have no way of passing it a LoggerRepository instance.
  +// WARNING It follows that this class should not log except when an LR instance
  +// WARNING is available.
   
   /**
    * This is a very simple ServletContextListener which detaches a
    * {@link LoggerRepository} from {@link ContextJNDISlector} when the
    * web-application is destroyed.
    *
  - * This class is highly coupled with JNDI but not necessarily
  + * <p>This class is highly coupled with JNDI but not necessarily
    * ContextJNDISlector.
  - *
  + * 
    * @author Ceki G&uuml;lc&uuml;
  - *
    * @since 1.3
    */
   public class ContextDetachingSCL implements ServletContextListener {
  -  static Logger logger = Logger.getLogger(ContextDetachingSCL.class);
   
  +  
     /**
      * When the context is destroy, detach the logging repository given by
      * the value of "log4j/context-name" environment variable.
  @@ -63,13 +66,15 @@
       }
   
       if (loggingContextName != null) {
  -      logger.debug(
  +      
  +      System.out.println(
           "About to detach logger context named [" + loggingContextName + "].");
   
         RepositorySelector repositorySelector =
           LogManager.getRepositorySelector();
         LoggerRepository lr = repositorySelector.detachRepository(loggingContextName);
         if(lr != null) {
  +        Logger logger = lr.getLogger(this.getClass().getName());
           logger.debug("About to shutdown logger repository named ["+lr.getName()+
               "]");
           lr.shutdown();
  @@ -81,7 +86,5 @@
      * Does nothing.
      */
     public void contextInitialized(ServletContextEvent sce) {
  -    ServletContext sc = sce.getServletContext();
  -    logger.debug("Context named ["+sc.getServletContextName()+"] initialized.");     
     }
   }
  
  
  
  1.7       +5 -2      logging-log4j/src/java/org/apache/log4j/rolling/FixedWindowRollingPolicy.java
  
  Index: FixedWindowRollingPolicy.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/rolling/FixedWindowRollingPolicy.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- FixedWindowRollingPolicy.java	6 Jan 2005 17:03:10 -0000	1.6
  +++ FixedWindowRollingPolicy.java	6 Jan 2005 19:27:03 -0000	1.7
  @@ -65,6 +65,7 @@
     int maxIndex;
     int minIndex;
     Util util = new Util();
  +  Compress compress = new Compress();
     
     /**
      * It's almost always a bad idea to have a large window size, say over 12. 
  @@ -80,9 +81,11 @@
     public void activateOptions() {
       // set the LR for our utility object
       util.setLoggerRepository(this.repository);
  +    compress.setLoggerRepository(this.repository);
       
       if (fileNamePatternStr != null) {
         fileNamePattern = new FileNamePattern(fileNamePatternStr);
  +      fileNamePattern.setLoggerRepository(this.repository);
         determineCompressionMode();
       } else {
         getLogger().warn(FNP_NOT_SET);
  @@ -149,10 +152,10 @@
             util.rename(activeFileName, fileNamePattern.convert(minIndex));
             break;
         case Compress.GZ:
  -          Compress.GZCompress(activeFileName, fileNamePattern.convert(minIndex));
  +          compress.GZCompress(activeFileName, fileNamePattern.convert(minIndex));
             break;	  
         case Compress.ZIP:
  -	  Compress.ZIPCompress(activeFileName, fileNamePattern.convert(minIndex));
  +	  compress.ZIPCompress(activeFileName, fileNamePattern.convert(minIndex));
   	  break;
         }
       }
  
  
  
  1.18      +8 -5      logging-log4j/src/java/org/apache/log4j/rolling/TimeBasedRollingPolicy.java
  
  Index: TimeBasedRollingPolicy.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/rolling/TimeBasedRollingPolicy.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- TimeBasedRollingPolicy.java	6 Jan 2005 17:03:10 -0000	1.17
  +++ TimeBasedRollingPolicy.java	6 Jan 2005 19:27:03 -0000	1.18
  @@ -145,14 +145,17 @@
     String elapsedPeriodsFileName;
     FileNamePattern activeFileNamePattern;
     Util util = new Util();
  +  Compress compress = new Compress();
     
     public void activateOptions() {
       // set the LR for our utility object
       util.setLoggerRepository(this.repository);
  +    compress.setLoggerRepository(this.repository);
       
       // find out period from the filename pattern
       if (fileNamePatternStr != null) {
         fileNamePattern = new FileNamePattern(fileNamePatternStr);
  +      fileNamePattern.setLoggerRepository(this.repository);
         determineCompressionMode();
       } else {
         getLogger().warn(FNP_NOT_SET);
  @@ -190,7 +193,7 @@
       getLogger().debug(
         "The date pattern is '{}' from file name pattern '{}'.",
         dtc.getDatePattern(), fileNamePattern.getPattern());
  -    rc.printPeriodicity();
  +    rc.printPeriodicity(getLogger());
   
       long n = System.currentTimeMillis();
       lastCheck.setTime(n);
  @@ -212,11 +215,11 @@
           break;
         case Compress.GZ:
           getLogger().debug("GZIP compressing [{}]", elapsedPeriodsFileName);
  -        Compress.GZCompress(elapsedPeriodsFileName);
  +        compress.GZCompress(elapsedPeriodsFileName);
           break;
         case Compress.ZIP:
           getLogger().debug("ZIP compressing [{}]", elapsedPeriodsFileName);
  -        Compress.ZIPCompress(elapsedPeriodsFileName);
  +        compress.ZIPCompress(elapsedPeriodsFileName);
           break;
         }
       } else {
  @@ -226,11 +229,11 @@
           break;
         case Compress.GZ:
           getLogger().debug("GZIP compressing [[}]", elapsedPeriodsFileName);
  -        Compress.GZCompress(activeFileName, elapsedPeriodsFileName);
  +        compress.GZCompress(activeFileName, elapsedPeriodsFileName);
           break;
         case Compress.ZIP:
           getLogger().debug("ZIP compressing [[}]", elapsedPeriodsFileName);
  -        Compress.ZIPCompress(activeFileName, elapsedPeriodsFileName);
  +        compress.ZIPCompress(activeFileName, elapsedPeriodsFileName);
           break;
         }
       }
  
  
  
  1.14      +2 -1      logging-log4j/src/java/org/apache/log4j/db/DBReceiver.java
  
  Index: DBReceiver.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/db/DBReceiver.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- DBReceiver.java	20 Nov 2004 15:13:04 -0000	1.13
  +++ DBReceiver.java	6 Jan 2005 19:27:03 -0000	1.14
  @@ -41,7 +41,8 @@
     public void activateOptions() {
       if (connectionSource != null) {
         receiverJob = new DBReceiverJob(this);
  -
  +      receiverJob.setLoggerRepository(repository);
  +      
         Scheduler scheduler = LogManager.getSchedulerInstance();
         scheduler.schedule(
           receiverJob, System.currentTimeMillis() + 500, refreshMillis);
  
  
  
  1.7       +4 -5      logging-log4j/src/java/org/apache/log4j/db/DBReceiverJob.java
  
  Index: DBReceiverJob.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/db/DBReceiverJob.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- DBReceiverJob.java	20 Nov 2004 15:13:04 -0000	1.6
  +++ DBReceiverJob.java	6 Jan 2005 19:27:03 -0000	1.7
  @@ -20,6 +20,7 @@
   import org.apache.log4j.Logger;
   import org.apache.log4j.helpers.Constants;
   import org.apache.log4j.scheduler.Job;
  +import org.apache.log4j.spi.ComponentBase;
   import org.apache.log4j.spi.LoggerRepository;
   import org.apache.log4j.spi.LoggingEvent;
   import org.apache.log4j.spi.ThrowableInformation;
  @@ -37,9 +38,7 @@
    * 
    * @author Ceki G&uuml;lc&uuml;
    */
  -class DBReceiverJob implements Job {
  -
  -  Logger logger = Logger.getLogger(DBReceiverJob.class);
  +class DBReceiverJob extends ComponentBase implements Job {
   
     long lastId = 0;
   
  @@ -50,7 +49,7 @@
     }
   
     public void execute() {
  -    logger.info("DBReceiverJob.execute() called");
  +    getLogger().info("DBReceiverJob.execute() called");
   
       Connection connection = null;
   
  @@ -136,7 +135,7 @@
         statement.close();
         statement = null;
       } catch (SQLException sqle) {
  -      logger.error("*************Problem receiving events", sqle);
  +      getLogger().error("Problem receiving events", sqle);
       } finally {
         closeConnection(connection);
       }
  
  
  
  1.15      +2 -4      logging-log4j/src/java/org/apache/joran/action/ParamAction.java
  
  Index: ParamAction.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/joran/action/ParamAction.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- ParamAction.java	19 Nov 2004 15:20:06 -0000	1.14
  +++ ParamAction.java	6 Jan 2005 19:27:03 -0000	1.15
  @@ -18,7 +18,6 @@
   
   import org.apache.joran.ExecutionContext;
   
  -import org.apache.log4j.Logger;
   import org.apache.log4j.config.PropertySetter;
   import org.apache.log4j.helpers.OptionConverter;
   import org.apache.log4j.spi.ErrorItem;
  @@ -27,7 +26,6 @@
   
   
   public class ParamAction extends Action {
  -  static final Logger logger = Logger.getLogger(ParamAction.class);
     static String NO_NAME = "No name attribute in <param> element";
     static String NO_VALUE = "No name attribute in <param> element";
     boolean inError = false;
  @@ -39,14 +37,14 @@
   
       if (name == null) {
         inError = true;
  -      logger.error(NO_NAME);
  +      getLogger().error(NO_NAME);
         ec.addError(new ErrorItem(NO_NAME));
         return;
       }
   
       if (value == null) {
         inError = true;
  -      logger.error(NO_VALUE);
  +      getLogger().error(NO_VALUE);
         ec.addError(new ErrorItem(NO_VALUE));
         return;
       }
  
  
  
  1.13      +4 -7      logging-log4j/src/java/org/apache/joran/action/NewRuleAction.java
  
  Index: NewRuleAction.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/joran/action/NewRuleAction.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- NewRuleAction.java	19 Nov 2004 15:20:06 -0000	1.12
  +++ NewRuleAction.java	6 Jan 2005 19:27:03 -0000	1.13
  @@ -20,14 +20,11 @@
   import org.apache.joran.Pattern;
   import org.apache.joran.helper.Option;
   
  -import org.apache.log4j.Logger;
   import org.apache.log4j.spi.ErrorItem;
   import org.xml.sax.Attributes;
   
   
   public class NewRuleAction extends Action {
  -  static final Logger logger = Logger.getLogger(NewRuleAction.class);
  -
     boolean inError = false;
     
     /**
  @@ -44,7 +41,7 @@
       if(Option.isEmpty(pattern)) {
          inError = true;
          errorMsg = "No 'pattern' attribute in <newRule>";
  -       logger.warn(errorMsg);
  +       getLogger().warn(errorMsg);
          ec.addError(new ErrorItem(errorMsg));
          return;
        }
  @@ -52,18 +49,18 @@
        if(Option.isEmpty(actionClass)) {
            inError = true;
            errorMsg = "No 'actionClass' attribute in <newRule>";
  -         logger.warn(errorMsg);
  +         getLogger().warn(errorMsg);
            ec.addError(new ErrorItem(errorMsg));
            return;
        }
          
       try {
  -      logger.debug("About to add new Joran parsing rule ["+pattern+","+actionClass+"].");
  +      getLogger().debug("About to add new Joran parsing rule ["+pattern+","+actionClass+"].");
         ec.getJoranInterpreter().getRuleStore().addRule(new Pattern(pattern), actionClass);
       } catch (Exception oops) {
         inError = true;
         errorMsg =  "Could not add new Joran parsing rule ["+pattern+","+actionClass+"]"; 
  -      logger.error(errorMsg, oops);
  +      getLogger().error(errorMsg, oops);
         ec.addError(new ErrorItem(errorMsg));
       }
     }
  
  
  
  1.6       +2 -6      logging-log4j/src/java/org/apache/log4j/pattern/NamedPatternConverter.java
  
  Index: NamedPatternConverter.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/pattern/NamedPatternConverter.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- NamedPatternConverter.java	22 Dec 2004 21:56:35 -0000	1.5
  +++ NamedPatternConverter.java	6 Jan 2005 19:27:03 -0000	1.6
  @@ -18,7 +18,6 @@
   
   import java.util.List;
   
  -import org.apache.log4j.Logger;
   import org.apache.log4j.spi.LoggingEvent;
   
   
  @@ -30,9 +29,6 @@
    */
   abstract class NamedPatternConverter extends PatternConverter {
   	
  -	
  -  static Logger logger = Logger.getLogger(NamedPatternConverter.class);
  -
     // We assume that each PatternConveter instance is unique within a layout, 
     // which is unique within an appender. We further assume that callas to the 
     // appender method are serialized (per appender).
  @@ -63,12 +59,12 @@
           precision = Integer.parseInt(option);
           //System.out.println("Precision is "+precision);
           if (precision <= 0) {
  -          logger.error(
  +          getLogger().error(
               "Precision option (" + option + ") isn't a positive integer.");
             precision = 0;
           }
         } catch (NumberFormatException e) {
  -        logger.error(
  +        getLogger().error(
             "Category option \"" + option + "\" not a decimal integer.", e);
         }
       }
  
  
  
  1.19      +2 -3      logging-log4j/src/java/org/apache/log4j/pattern/DatePatternConverter.java
  
  Index: DatePatternConverter.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/pattern/DatePatternConverter.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- DatePatternConverter.java	6 Jan 2005 17:03:11 -0000	1.18
  +++ DatePatternConverter.java	6 Jan 2005 19:27:03 -0000	1.19
  @@ -16,7 +16,6 @@
   
   package org.apache.log4j.pattern;
   
  -import org.apache.log4j.Logger;
   import org.apache.log4j.helpers.Constants;
   import org.apache.log4j.spi.LoggingEvent;
   import java.text.SimpleDateFormat;
  @@ -33,7 +32,7 @@
     // We assume that each PatternConveter instance is unique within a layout, 
     // which is unique within an appender. We further assume that calls to the 
     // appender method are serialized (per appender).
  -  Logger logger = Logger.getLogger(DatePatternConverter.class);
  +
     private CachedDateFormat df;
     private final StringBuffer buf = new StringBuffer(30); 
   
  @@ -80,7 +79,7 @@
         simpleFormat = new SimpleDateFormat(pattern);
         maximumCacheValidity = CachedDateFormat.getMaximumCacheValidity(pattern);
       } catch (IllegalArgumentException e) {
  -      logger.warn(
  +      getLogger().warn(
           "Could not instantiate SimpleDateFormat with pattern " + patternOption, e);
         // default to the ISO8601 format
         simpleFormat = new SimpleDateFormat(Constants.ISO8601_PATTERN);
  
  
  
  1.12      +8 -9      logging-log4j/src/java/org/apache/log4j/net/SocketHubAppender.java
  
  Index: SocketHubAppender.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/net/SocketHubAppender.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- SocketHubAppender.java	14 Dec 2004 21:01:41 -0000	1.11
  +++ SocketHubAppender.java	6 Jan 2005 19:27:03 -0000	1.12
  @@ -299,7 +299,6 @@
       private Vector oosList;
       private boolean keepRunning;
       private Thread monitorThread;
  -    Logger logger = Logger.getLogger(ServerMonitor.class);
       
       /**
         Create a thread and start the monitor. */
  @@ -317,7 +316,7 @@
         the thread has finished executing. */
       public synchronized void stopMonitor() {
         if (keepRunning) {
  -        logger.debug("server monitor thread shutting down");
  +        getLogger().debug("server monitor thread shutting down");
           keepRunning = false;
   
           try {
  @@ -328,7 +327,7 @@
   
           // release the thread
           monitorThread = null;
  -        logger.debug("server monitor thread shut down");
  +        getLogger().debug("server monitor thread shut down");
         }
       }
       
  @@ -352,7 +351,7 @@
           serverSocket = new ServerSocket(port);
           serverSocket.setSoTimeout(1000);
         } catch (Exception e) {
  -        logger.error(
  +        getLogger().error(
             "exception setting timeout, shutting down server socket.", e);
           keepRunning = false;
   
  @@ -363,7 +362,7 @@
           try {
             serverSocket.setSoTimeout(1000);
           } catch (SocketException e) {
  -          logger.error(
  +          getLogger().error(
               "exception setting timeout, shutting down server socket.", e);
   
             return;
  @@ -377,18 +376,18 @@
             } catch (InterruptedIOException e) {
               // timeout occurred, so just loop
             } catch (SocketException e) {
  -            logger.error(
  +            getLogger().error(
                 "exception accepting socket, shutting down server socket.", e);
               keepRunning = false;
             } catch (IOException e) {
  -            logger.error("exception accepting socket.", e);
  +            getLogger().error("exception accepting socket.", e);
             }
   
             // if there was a socket accepted
             if (socket != null) {
               try {
                 InetAddress remoteAddress = socket.getInetAddress();
  -              logger.debug(
  +              getLogger().debug(
                   "accepting connection from {} ({})", remoteAddress.getHostName()
                   , remoteAddress.getHostAddress());
   
  @@ -402,7 +401,7 @@
                 // add it to the oosList.  OK since Vector is synchronized.
                 oosList.addElement(oos);
               } catch (IOException e) {
  -              logger.error("exception creating output stream on socket.", e);
  +              getLogger().error("exception creating output stream on socket.", e);
               }
             }
           }
  
  
  
  1.12      +3 -3      logging-log4j/src/java/org/apache/log4j/net/TelnetAppender.java
  
  Index: TelnetAppender.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/net/TelnetAppender.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- TelnetAppender.java	21 Dec 2004 01:49:25 -0000	1.11
  +++ TelnetAppender.java	6 Jan 2005 19:27:03 -0000	1.12
  @@ -127,8 +127,8 @@
       private Vector connections = new Vector();
       private ServerSocket serverSocket;
       private int MAX_CONNECTIONS = 20;
  -    private Logger logger = Logger.getLogger(SocketHandler.class);
  -      private String encoding = "UTF-8";
  +    
  +    private String encoding = "UTF-8";
       
       public SocketHandler(int port) throws IOException {
         serverSocket = new ServerSocket(port);
  @@ -200,7 +200,7 @@
               newClient.close();
             }
           } catch (Exception e) {
  -          logger.error("Encountered error while in SocketHandler loop.", e);
  +          getLogger().error("Encountered error while in SocketHandler loop.", e);
           }
         }
       }
  
  
  
  1.13      +6 -8      logging-log4j/src/java/org/apache/log4j/net/SocketHubReceiver.java
  
  Index: SocketHubReceiver.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/net/SocketHubReceiver.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- SocketHubReceiver.java	20 Nov 2004 15:46:02 -0000	1.12
  +++ SocketHubReceiver.java	6 Jan 2005 19:27:03 -0000	1.13
  @@ -14,7 +14,6 @@
   import java.util.Iterator;
   import java.util.List;
   
  -import org.apache.log4j.Logger;
   import org.apache.log4j.plugins.Plugin;
   import org.apache.log4j.plugins.Receiver;
   import org.apache.log4j.spi.LoggerRepository;
  @@ -248,7 +247,6 @@
   
       boolean interrupted = false;
       boolean doDelay;
  -    Logger logger = Logger.getLogger(Connector.class);
       
       public Connector(boolean isReconnect) {
         doDelay = isReconnect;
  @@ -258,23 +256,23 @@
         while(!interrupted) {
           try {
          	  if (doDelay) {
  -       	    logger.debug("waiting for " + reconnectionDelay + 
  +       	    getLogger().debug("waiting for " + reconnectionDelay + 
          	      " milliseconds before reconnecting.");
          	    sleep(reconnectionDelay);
          	  }
          	  doDelay = true;
  -       	  logger.debug("Attempting connection to "+ host);
  +       	  getLogger().debug("Attempting connection to "+ host);
         	  Socket socket = new Socket(host, port);
         	  setSocket(socket);
  -      	  logger.debug("Connection established. Exiting connector thread.");
  +      	  getLogger().debug("Connection established. Exiting connector thread.");
         	  break;
         	} catch(InterruptedException e) {
  -      	  logger.debug("Connector interrupted. Leaving loop.");
  +      	  getLogger().debug("Connector interrupted. Leaving loop.");
         	  return;
         	} catch(java.net.ConnectException e) {
  -      	  logger.debug("Remote host {} refused connection.", host);
  +      	  getLogger().debug("Remote host {} refused connection.", host);
         	} catch(IOException e) {
  -      	  logger.debug("Could not connect to {}. Exception is {}.", host, e);
  +      	  getLogger().debug("Could not connect to {}. Exception is {}.", host, e);
         	}
         }
       }
  
  
  
  1.10      +1 -0      logging-log4j/src/java/org/apache/log4j/net/XMLSocketReceiver.java
  
  Index: XMLSocketReceiver.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/net/XMLSocketReceiver.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- XMLSocketReceiver.java	20 Nov 2004 15:46:02 -0000	1.9
  +++ XMLSocketReceiver.java	6 Jan 2005 19:27:03 -0000	1.10
  @@ -238,6 +238,7 @@
             socketList.add(socket);
   
             XMLSocketNode node = new XMLSocketNode(decoder, socket, this);
  +          node.setLoggerRepository(this.repository);
             new Thread(node).start();
             socket = null;
           }
  
  
  
  1.8       +5 -8      logging-log4j/src/java/org/apache/log4j/net/JMSReceiver.java
  
  Index: JMSReceiver.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/net/JMSReceiver.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- JMSReceiver.java	27 Jun 2004 23:54:41 -0000	1.7
  +++ JMSReceiver.java	6 Jan 2005 19:27:03 -0000	1.8
  @@ -25,7 +25,6 @@
   import javax.naming.NameNotFoundException;
   import javax.naming.NamingException;
   
  -import org.apache.log4j.Logger;
   import org.apache.log4j.spi.LoggingEvent;
   import org.apache.log4j.plugins.Plugin;
   import org.apache.log4j.plugins.Receiver;
  @@ -49,8 +48,6 @@
   */
   public class JMSReceiver extends Receiver implements MessageListener {
   
  -  private static Logger logger = Logger.getLogger(JMSReceiver.class);
  -
     private boolean active = false;
   
     protected String topicFactoryName;
  @@ -237,7 +234,7 @@
             }
             topicConnection = null;
           }
  -        logger.error("Could not start JMSReceiver.", e);
  +        getLogger().error("Could not start JMSReceiver.", e);
         }
       }
     }
  @@ -273,19 +270,19 @@
           
         	doPost(event);
         } else {
  -      	logger.warn("Received message is of type "+message.getJMSType()
  +      	getLogger().warn("Received message is of type "+message.getJMSType()
   		    +", was expecting ObjectMessage.");
         }      
       } catch(Exception e) {
  -      logger.error("Exception thrown while processing incoming message.", e);
  +      getLogger().error("Exception thrown while processing incoming message.", e);
       }
     }
   
  -  protected static Object lookup(Context ctx, String name) throws NamingException {
  +  protected Object lookup(Context ctx, String name) throws NamingException {
       try {
         return ctx.lookup(name);
       } catch(NameNotFoundException e) {
  -      logger.error("Could not find name ["+name+"].");
  +      getLogger().error("Could not find name ["+name+"].");
         throw e;
       }
     }
  
  
  
  1.33      +12 -12    logging-log4j/src/java/org/apache/log4j/net/SocketNode.java
  
  Index: SocketNode.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/net/SocketNode.java,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- SocketNode.java	10 Aug 2004 06:16:56 -0000	1.32
  +++ SocketNode.java	6 Jan 2005 19:27:03 -0000	1.33
  @@ -28,6 +28,7 @@
   import org.apache.log4j.Logger;
   import org.apache.log4j.plugins.Pauseable;
   import org.apache.log4j.plugins.Receiver;
  +import org.apache.log4j.spi.ComponentBase;
   import org.apache.log4j.spi.LoggerRepository;
   import org.apache.log4j.spi.LoggingEvent;
   
  @@ -47,11 +48,10 @@
   
       @since 0.8.4
   */
  -public class SocketNode implements Runnable, Pauseable {
  -  static Logger logger = Logger.getLogger(SocketNode.class);
  +public class SocketNode extends ComponentBase implements Runnable, Pauseable {
  +
     private boolean paused;
     private Socket socket;
  -  private LoggerRepository hierarchy;
     private Receiver receiver;
     private SocketNodeEventListener listener;
     private List listenerList = Collections.synchronizedList(new ArrayList());
  @@ -60,7 +60,7 @@
       Constructor for socket and logger repository. */
     public SocketNode(Socket socket, LoggerRepository hierarchy) {
       this.socket = socket;
  -    this.hierarchy = hierarchy;
  +    this.repository = hierarchy;
     }
   
     /**
  @@ -115,7 +115,7 @@
       } catch (Exception e) {
         ois = null;
         listenerException = e;
  -      logger.error("Exception opening ObjectInputStream to " + socket, e);
  +      getLogger().error("Exception opening ObjectInputStream to " + socket, e);
       }
   
       if (ois != null) {
  @@ -145,7 +145,7 @@
               } else {
                 // get a logger from the hierarchy. The name of the logger
                 // is taken to be the name contained in the event.
  -              remoteLogger = hierarchy.getLogger(event.getLoggerName());
  +              remoteLogger = repository.getLogger(event.getLoggerName());
   
                 //event.logger = remoteLogger;
                 // apply the logger-level filter
  @@ -161,17 +161,17 @@
             }
           }
         } catch (java.io.EOFException e) {
  -        logger.info("Caught java.io.EOFException closing connection.");
  +        getLogger().info("Caught java.io.EOFException closing connection.");
           listenerException = e;
         } catch (java.net.SocketException e) {
  -        logger.info("Caught java.net.SocketException closing connection.");
  +        getLogger().info("Caught java.net.SocketException closing connection.");
           listenerException = e;
         } catch (IOException e) {
  -        logger.info("Caught java.io.IOException: " + e);
  -        logger.info("Closing connection.");
  +        getLogger().info("Caught java.io.IOException: " + e);
  +        getLogger().info("Closing connection.");
           listenerException = e;
         } catch (Exception e) {
  -        logger.error("Unexpected exception. Closing connection.", e);
  +        getLogger().error("Unexpected exception. Closing connection.", e);
           listenerException = e;
         }
       }
  @@ -182,7 +182,7 @@
           ois.close();
         }
       } catch (Exception e) {
  -      //logger.info("Could not close connection.", e);
  +      //getLogger().info("Could not close connection.", e);
       }
   
       // send event to listener, if configured
  
  
  
  1.8       +64 -64    logging-log4j/src/java/org/apache/log4j/net/XMLSocketNode.java
  
  Index: XMLSocketNode.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/net/XMLSocketNode.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- XMLSocketNode.java	20 Nov 2004 15:51:33 -0000	1.7
  +++ XMLSocketNode.java	6 Jan 2005 19:27:03 -0000	1.8
  @@ -1,12 +1,12 @@
   /*
    * Copyright 1999,2004 The Apache Software Foundation.
  - * 
  + *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
    * You may obtain a copy of the License at
  - * 
  + *
    *      http://www.apache.org/licenses/LICENSE-2.0
  - * 
  + *
    * Unless required by applicable law or agreed to in writing, software
    * distributed under the License is distributed on an "AS IS" BASIS,
    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  @@ -42,18 +42,17 @@
   
       @since 0.8.4
   */
  -public class XMLSocketNode implements Runnable {
  -  Logger logger = Logger.getLogger(XMLSocketNode.class);
  +public class XMLSocketNode extends ComponentBase implements Runnable {
     Socket socket;
  -  LoggerRepository hierarchy;
     Receiver receiver;
     Decoder decoder;
     SocketNodeEventListener listener;
  -  
  +
     /**
       Constructor for socket and logger repository. */
     public XMLSocketNode(
       String decoder, Socket socket, LoggerRepository hierarchy) {
  +    this.repository = hierarchy;
       try {
         Class c = Class.forName(decoder);
         Object o = c.newInstance();
  @@ -62,15 +61,14 @@
           this.decoder = (Decoder) o;
         }
       } catch (ClassNotFoundException cnfe) {
  -      logger.warn("Unable to find decoder", cnfe);
  +      getLogger().warn("Unable to find decoder", cnfe);
       } catch (IllegalAccessException iae) {
  -      logger.warn("Unable to construct decoder", iae);
  +      getLogger().warn("Unable to construct decoder", iae);
       } catch (InstantiationException ie) {
  -      logger.warn("Unable to construct decoder", ie);
  +      getLogger().warn("Unable to construct decoder", ie);
       }
   
       this.socket = socket;
  -    this.hierarchy = hierarchy;
     }
   
     /**
  @@ -84,11 +82,11 @@
           this.decoder = (Decoder) o;
         }
       } catch (ClassNotFoundException cnfe) {
  -      logger.warn("Unable to find decoder", cnfe);
  +      getLogger().warn("Unable to find decoder", cnfe);
       } catch (IllegalAccessException iae) {
  -      logger.warn("Unable to construct decoder", iae);
  +      getLogger().warn("Unable to construct decoder", iae);
       } catch (InstantiationException ie) {
  -      logger.warn("Unable to construct decoder", ie);
  +      getLogger().warn("Unable to construct decoder", ie);
       }
   
       this.socket = socket;
  @@ -101,7 +99,7 @@
       listener = _listener;
     }
   
  -    public void run() {
  +  public void run() {
       Logger remoteLogger;
       Exception listenerException = null;
       InputStream is = null;
  @@ -111,7 +109,7 @@
         listenerException =
           new Exception(
             "No receiver or decoder provided.  Cannot process xml socket events");
  -      logger.error(
  +      getLogger().error(
           "Exception constructing XML Socket Receiver", listenerException);
       }
   
  @@ -120,7 +118,7 @@
       } catch (Exception e) {
         is = null;
         listenerException = e;
  -      logger.error("Exception opening ObjectInputStream to " + socket, e);
  +      getLogger().error("Exception opening ObjectInputStream to " + socket, e);
       }
   
       if (is != null) {
  @@ -128,66 +126,68 @@
           socket.getInetAddress().getHostName() + ":" + socket.getPort();
   
         try {
  -            //read data from the socket
  -            //it's up to the individual decoder to handle incomplete event data
  -            while (true) {
  -                byte[] b=new byte[1024];
  -                int length = is.read(b);
  -                if (length == -1) {
  -                	logger.info("no bytes read from stream - closing connection.");
  -                	break;
  -                }
  -                List v= decoder.decodeEvents(new String(b, 0, length));
  +        //read data from the socket
  +        //it's up to the individual decoder to handle incomplete event data
  +        while (true) {
  +          byte[] b = new byte[1024];
  +          int length = is.read(b);
  +          if (length == -1) {
  +            getLogger().info(
  +              "no bytes read from stream - closing connection.");
  +            break;
  +          }
  +          List v = decoder.decodeEvents(new String(b, 0, length));
   
  -            if (v != null) {
  -              Iterator iter = v.iterator();
  +          if (v != null) {
  +            Iterator iter = v.iterator();
   
  -              while (iter.hasNext()) {
  -                LoggingEvent e = (LoggingEvent) iter.next();
  -                //if machinename property was not set (the case if properties
  -                //not supported by the DTD), use remoteinfo as machine name
  -                if (e.getProperty(Constants.HOSTNAME_KEY)==null) {
  -                	e.setProperty(Constants.HOSTNAME_KEY, remoteInfo);
  -                }
  +            while (iter.hasNext()) {
  +              LoggingEvent e = (LoggingEvent) iter.next();
   
  -                // store the known remote info in an event property
  -                e.setProperty("log4j.remoteSourceInfo", remoteInfo);
  +              //if machinename property was not set (the case if properties
  +              //not supported by the DTD), use remoteinfo as machine name
  +              if (e.getProperty(Constants.HOSTNAME_KEY) == null) {
  +                e.setProperty(Constants.HOSTNAME_KEY, remoteInfo);
  +              }
   
  -                // if configured with a receiver, tell it to post the event
  -                if (receiver != null) {
  -                  receiver.doPost(e);
  -
  -                  // else post it via the hierarchy
  -                } else {
  -                  // get a logger from the hierarchy. The name of the logger
  -                  // is taken to be the name contained in the event.
  -                  remoteLogger = hierarchy.getLogger(e.getLoggerName());
  -
  -                  //event.logger = remoteLogger;
  -                  // apply the logger-level filter
  -                  if (
  -                    e.getLevel().isGreaterOrEqual(
  -                        remoteLogger.getEffectiveLevel())) {
  -                    // finally log the event as if was generated locally
  -                    remoteLogger.callAppenders(e);
  -                  }
  -                }
  +              // store the known remote info in an event property
  +              e.setProperty("log4j.remoteSourceInfo", remoteInfo);
  +
  +              // if configured with a receiver, tell it to post the event
  +              if (receiver != null) {
  +                receiver.doPost(e);
  +
  +                // else post it via the hierarchy
  +              } else {
  +                // get a logger from the hierarchy. The name of the logger
  +                // is taken to be the name contained in the event.
  +                remoteLogger = repository.getLogger(e.getLoggerName());
  +
  +                //event.logger = remoteLogger;
  +                // apply the logger-level filter
  +                if (
  +                  e.getLevel().isGreaterOrEqual(
  +                      remoteLogger.getEffectiveLevel())) {
  +                  // finally log the event as if was generated locally
  +                  remoteLogger.callAppenders(e);
                   }
                 }
  -
  +            }
             }
  +        }
         } catch (java.io.EOFException e) {
  -        logger.info("Caught java.io.EOFException closing connection.");
  +        getLogger().info("Caught java.io.EOFException closing connection.");
           listenerException = e;
         } catch (java.net.SocketException e) {
  -        logger.info("Caught java.net.SocketException closing connection.");
  +        getLogger().info(
  +          "Caught java.net.SocketException closing connection.");
           listenerException = e;
         } catch (IOException e) {
  -        logger.info("Caught java.io.IOException: " + e);
  -        logger.info("Closing connection.");
  +        getLogger().info("Caught java.io.IOException: " + e);
  +        getLogger().info("Closing connection.");
           listenerException = e;
         } catch (Exception e) {
  -        logger.error("Unexpected exception. Closing connection.", e);
  +        getLogger().error("Unexpected exception. Closing connection.", e);
           listenerException = e;
         }
       }
  @@ -198,7 +198,7 @@
           is.close();
         }
       } catch (Exception e) {
  -		//logger.info("Could not close connection.", e);
  +      //logger.info("Could not close connection.", e);
       }
   
       // send event to listener, if configured
  
  
  
  1.22      +22 -9     logging-log4j/src/java/org/apache/joran/Interpreter.java
  
  Index: Interpreter.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/joran/Interpreter.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- Interpreter.java	1 Dec 2004 09:41:00 -0000	1.21
  +++ Interpreter.java	6 Jan 2005 19:27:04 -0000	1.22
  @@ -18,8 +18,10 @@
   
   import org.apache.joran.action.*;
   import org.apache.log4j.LogManager;
  -import org.apache.log4j.Logger;
  +import org.apache.log4j.spi.Component;
   import org.apache.log4j.spi.ErrorItem;
  +import org.apache.log4j.spi.LoggerRepository;
  +import org.apache.ugli.ULogger;
   
   import org.xml.sax.Attributes;
   import org.xml.sax.EntityResolver;
  @@ -66,7 +68,7 @@
    * @author Ceki G&uuml;lcu&uuml;
    *
    */
  -public class Interpreter extends DefaultHandler {
  +public class Interpreter extends DefaultHandler implements Component  {
     private static List EMPTY_LIST = new Vector(0);
     private RuleStore ruleStore;
     private ExecutionContext ec;
  @@ -74,13 +76,13 @@
     Pattern pattern;
     Locator locator;
   
  -  Logger logger = LogManager.getLogger(Interpreter.class);
  -  
     // The entity resolver is only needed in order to be compatible with
     // XML files written for DOMConfigurator containing the following DOCTYPE
     // <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
     private EntityResolver entityResolver;
     
  +  private LoggerRepository repository;
  +  
     /**
      * The <id>actionListStack</id> contains a list of actions that are
      * executing for the given XML element.
  @@ -126,7 +128,7 @@
         String errMsg =
           "no applicable action for <" + tagName + ">, current pattern is ["
           + pattern+"]";
  -      logger.warn(errMsg);
  +      getLogger().warn(errMsg);
         ec.addError(new ErrorItem(errMsg));
       }
     }
  @@ -262,21 +264,21 @@
   
     public void error(SAXParseException spe) throws SAXException {
       ec.addError(new ErrorItem("Parsing error", spe));
  -    logger.error(
  +    getLogger().error(
         "Parsing problem on line " + spe.getLineNumber() + " and column "
         + spe.getColumnNumber(), spe);
     }
   
     public void fatalError(SAXParseException spe) throws SAXException {
       ec.addError(new ErrorItem("Parsing fatal error", spe));
  -    logger.error(
  +    getLogger().error(
         "Parsing problem on line " + spe.getLineNumber() + " and column "
         + spe.getColumnNumber(), spe);
     }
   
     public void warning(SAXParseException spe) throws SAXException {
       ec.addError(new ErrorItem("Parsing warning", spe));
  -    logger.warn(
  +    getLogger().warn(
         "Parsing problem on line " + spe.getLineNumber() + " and column "
         + spe.getColumnNumber(), spe);
     }
  @@ -336,5 +338,16 @@
         }
       }
     }
  -  
  +
  +  public void setLoggerRepository(LoggerRepository repository) {
  +    this.repository = repository;
  +  }
  +
  +  protected ULogger getLogger() {
  +    if(repository != null) {
  +      return repository.getLogger(this.getClass().getName());
  +    } else {
  +      return LogManager.SIMPLE_LOGGER_FA.getLogger(this.getClass().getName());
  +    }
  +  } 
   }
  
  
  
  1.71      +6 -826    logging-log4j/src/java/org/apache/log4j/xml/DOMConfigurator.java
  
  Index: DOMConfigurator.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/xml/DOMConfigurator.java,v
  retrieving revision 1.70
  retrieving revision 1.71
  diff -u -r1.70 -r1.71
  --- DOMConfigurator.java	6 Jan 2005 17:03:12 -0000	1.70
  +++ DOMConfigurator.java	6 Jan 2005 19:27:04 -0000	1.71
  @@ -17,30 +17,7 @@
   package org.apache.log4j.xml;
   
   import org.apache.log4j.*;
  -import org.apache.log4j.config.PropertySetter;
  -import org.apache.log4j.helpers.*;
  -import org.apache.log4j.or.RendererMap;
  -import org.apache.log4j.plugins.Plugin;
  -import org.apache.log4j.spi.*;
  -
  -import org.w3c.dom.*;
  -
  -import org.xml.sax.InputSource;
  -
  -import java.io.FileInputStream;
  -import java.io.IOException;
  -import java.io.InputStream;
  -import java.io.Reader;
  -
  -import java.lang.reflect.Method;
  -
  -import java.net.URL;
  -
  -import java.util.*;
  -
  -import javax.xml.parsers.DocumentBuilder;
  -import javax.xml.parsers.DocumentBuilderFactory;
  -import javax.xml.parsers.FactoryConfigurationError;
  +import org.apache.log4j.joran.JoranConfigurator;
   
   
   // Contributors:   Mark Womack
  @@ -70,808 +47,11 @@
      @author Anders Kristensen
      @deprecated Replaced by the much more flexible {@link org.apache.log4j.joran.JoranConfigurator}.
      @since 0.8.3 */
  -public class DOMConfigurator extends ComponentBase implements Configurator {
  -
  -  static final String CONFIGURATION_TAG = "log4j:configuration";
  -  static final String OLD_CONFIGURATION_TAG = "configuration";
  -  static final String RENDERER_TAG = "renderer";
  -  static final String APPENDER_TAG = "appender";
  -  static final String APPENDER_REF_TAG = "appender-ref";
  -  static final String PARAM_TAG = "param";
  -  static final String LAYOUT_TAG = "layout";
  -  static final String CATEGORY = "category";
  -  static final String LOGGER = "logger";
  -  static final String LOGGER_REF = "logger-ref";
  -  static final String CATEGORY_FACTORY_TAG = "categoryFactory";
  -  static final String NAME_ATTR = "name";
  -  static final String CLASS_ATTR = "class";
  -  static final String VALUE_ATTR = "value";
  -  static final String ROOT_TAG = "root";
  -  static final String ROOT_REF = "root-ref";
  -  static final String LEVEL_TAG = "level";
  -  static final String PRIORITY_TAG = "priority";
  -  static final String FILTER_TAG = "filter";
  -  static final String ERROR_HANDLER_TAG = "errorHandler";
  -  static final String REF_ATTR = "ref";
  -  static final String ADDITIVITY_ATTR = "additivity";
  -  static final String THRESHOLD_ATTR = "threshold";
  -  static final String CONFIG_DEBUG_ATTR = "configDebug";
  -  static final String INTERNAL_DEBUG_ATTR = "debug";
  -  static final String RENDERING_CLASS_ATTR = "renderingClass";
  -  static final String RENDERED_CLASS_ATTR = "renderedClass";
  -  static final String PLUGIN_TAG = "plugin";
  -  static final String EMPTY_STR = "";
  -  static final Class[] ONE_STRING_PARAM = new Class[] { String.class };
  -  static final String dbfKey = "javax.xml.parsers.DocumentBuilderFactory";
  -
  -  // key: appenderName, value: appender
  -  Hashtable appenderBag;
  -  Properties props;
  -  OptionConverter optionConverter = new OptionConverter();
  +public class DOMConfigurator extends JoranConfigurator {
     
  -  /**
  -     No argument constructor.
  -  */
  -  public DOMConfigurator() {
  -    appenderBag = new Hashtable();
  -  }
  -
  -  /**
  -     Used internally to parse appenders by IDREF name.
  -  */
  -  protected Appender findAppenderByName(Document doc, String appenderName) {
  -    Appender appender = (Appender) appenderBag.get(appenderName);
  -
  -    if (appender != null) {
  -      return appender;
  -    } else {
  -      // Doesn't work on DOM Level 1 :
  -      // Element element = doc.getElementById(appenderName);
  -      // Endre's hack:
  -      Element element = null;
  -      NodeList list = doc.getElementsByTagName("appender");
  -
  -      for (int t = 0; t < list.getLength(); t++) {
  -        Node node = list.item(t);
  -        NamedNodeMap map = node.getAttributes();
  -        Node attrNode = map.getNamedItem("name");
  -
  -        if (appenderName.equals(attrNode.getNodeValue())) {
  -          element = (Element) node;
  -
  -          break;
  -        }
  -      }
  -
  -      // Hack finished.
  -      if (element == null) {
  -        LogLog.error(
  -          "No appender named [" + appenderName + "] could be found.");
  -
  -        return null;
  -      } else {
  -        appender = parseAppender(element);
  -        appenderBag.put(appenderName, appender);
  -
  -        return appender;
  -      }
  -    }
  -  }
  -
  -  /**
  -     Used internally to parse appenders by IDREF element.
  -   */
  -  protected Appender findAppenderByReference(Element appenderRef) {
  -    String appenderName = subst(appenderRef.getAttribute(REF_ATTR));
  -    Document doc = appenderRef.getOwnerDocument();
  -
  -    return findAppenderByName(doc, appenderName);
  -  }
  -
  -  /**
  -     Used internally to parse an appender element.
  -   */
  -  protected Appender parseAppender(Element appenderElement) {
  -    String className = subst(appenderElement.getAttribute(CLASS_ATTR));
  -    LogLog.debug("Class name: [" + className + ']');
  -
  -    try {
  -      Object instance = Loader.loadClass(className).newInstance();
  -      Appender appender = (Appender) instance;
  -      PropertySetter propSetter = new PropertySetter(appender);
  -
  -      appender.setName(subst(appenderElement.getAttribute(NAME_ATTR)));
  -
  -      NodeList children = appenderElement.getChildNodes();
  -      final int length = children.getLength();
  -
  -      for (int loop = 0; loop < length; loop++) {
  -        Node currentNode = children.item(loop);
  -
  -        /* We're only interested in Elements */
  -        if (!isElement(currentNode)) {
  -          continue;
  -        }
  -
  -        Element currentElement = (Element) currentNode;
  -
  -        // Parse appender parameters 
  -        if (currentElement.getTagName().equals(PARAM_TAG)) {
  -          setParameter(currentElement, propSetter);
  -        //} else if (currentElement.getTagName().equals(ERROR_HANDLER_TAG)) {
  -          //parseErrorHandler(currentElement, appender);
  -        } else if (currentElement.getTagName().equals(APPENDER_REF_TAG)) {
  -          String refName = subst(currentElement.getAttribute(REF_ATTR));
  -
  -          if (appender instanceof AppenderAttachable) {
  -            AppenderAttachable aa = (AppenderAttachable) appender;
  -            LogLog.debug(
  -              "Attaching appender named [" + refName + "] to appender named ["
  -              + appender.getName() + "].");
  -            aa.addAppender(findAppenderByReference(currentElement));
  -          } else {
  -            LogLog.error(
  -              "Requesting attachment of appender named [" + refName
  -              + "] to appender named [" + appender.getName()
  -              + "] which does not implement org.apache.log4j.spi.AppenderAttachable.");
  -          }
  -        } else {
  -          getLogger().debug(
  -            "Handling nested <" + currentElement.getTagName()
  -            + "> for appender " + appender.getName());
  -          configureNestedComponent(propSetter, currentElement);
  -        }
  -      }
  -
  -      if (appender instanceof OptionHandler) {
  -        ((OptionHandler) appender).activateOptions();
  -      }
  -
  -      return appender;
  -    }
  -    /* Yes, it's ugly.  But all of these exceptions point to the same
  -       problem: we can't create an Appender */
  -     catch (Exception oops) {
  -      LogLog.error(
  -        "Could not create an Appender. Reported error follows.", oops);
  -
  -      return null;
  -    }
  -  }
  -
  -  protected void configureNestedComponent(
  -    PropertySetter parentBean, Element nestedElement) {
  -    String nestedElementTagName = nestedElement.getTagName();
  -
  -    int containmentType = parentBean.canContainComponent(nestedElementTagName);
  -
  -    if (containmentType == PropertySetter.NOT_FOUND) {
  -      getLogger().warn(
  -        "A component with tag name [{}] cannot be contained within an object of class [{}].", nestedElementTagName, parentBean.getObjClass().getName());
  -
  -      return; // nothing can be done
  -    }
  -    String className = subst(nestedElement.getAttribute(CLASS_ATTR));
  -
  -    getLogger().debug("Will instantiate instance of class []", className);
  -
  -    Object nestedComponent = null;
  -
  -    // instantiate the nested component
  -    try {
  -      nestedComponent = Loader.loadClass(className).newInstance();
  -    } catch (Exception e) {
  -      getLogger().warn(
  -        "Could not instantiate object of type [" + className + "].", e);
  -
  -      return;
  -    }
  -
  -    // set the parameters of the nested component and/or configure the
  -    // nested compoments nested within
  -    NodeList children = nestedElement.getChildNodes();
  -    final int length = children.getLength();
  -    PropertySetter nestedBean = new PropertySetter(nestedComponent);
  -
  -    for (int loop = 0; loop < length; loop++) {
  -      Node currentNode = children.item(loop);
  -
  -      /* We're only interested in Elements */
  -      if (!isElement(currentNode)) {
  -        continue;
  -      }
  -
  -      Element currentElement = (Element) currentNode;
  -
  -      if (hasParamTag(currentElement)) {
  -         getLogger().debug(
  -            "***Configuring parameter [{}] for <{}>.", currentElement.getAttribute("name"), nestedElementTagName);
  -        setParameter(currentElement, nestedBean);
  -      } else {
  -          getLogger().debug(
  -            "Configuring component {} with tagged as <{}>.", nestedComponent, currentElement.getTagName());
  -        configureNestedComponent(nestedBean, currentElement);
  -      }
  -    }
  -
  -    // once all the options are set, activate the nested component
  -    if (nestedComponent instanceof OptionHandler) {
  -      ((OptionHandler) nestedComponent).activateOptions();
  -    }
  -
  -    // Now let us attach the component
  -    switch (containmentType) {
  -    case PropertySetter.AS_PROPERTY:
  -      parentBean.setComponent(nestedElementTagName, nestedComponent);
  -
  -      break;
  -
  -    case PropertySetter.AS_COLLECTION:
  -      parentBean.addComponent(nestedElementTagName, nestedComponent);
  -
  -      break;
  -    }
  -  }
  -
  -  /**
  -   * Returns <code>true</code> if the node passed as parameter is an
  -   * Element, returns <code>false</code> otherwise.
  -   * */
  -  protected boolean isElement(Node node) {
  -    return (node.getNodeType() == Node.ELEMENT_NODE);
  -  }
  -
  -  /**
  -   * Returns <code>true</code> if the element has the param tag,
  -   * returns false otherwise.
  -   * */
  -  protected boolean hasParamTag(Element element) {
  -    return element.getTagName().equals(PARAM_TAG);
  -  }
  -
  -  /**
  -     Used internally to parse an {@link ErrorHandler} element.
  -   */
  -//  protected void parseErrorHandler(Element element, Appender appender) {
  -//    ErrorHandler eh =
  -//      (ErrorHandler) optionConverter.instantiateByClassName(
  -//        subst(element.getAttribute(CLASS_ATTR)),
  -//        org.apache.log4j.spi.ErrorHandler.class, null);
  -//
  -//    if (eh != null) {
  -//      eh.setAppender(appender);
  -//
  -//      PropertySetter propSetter = new PropertySetter(eh);
  -//      NodeList children = element.getChildNodes();
  -//      final int length = children.getLength();
  -//
  -//      for (int loop = 0; loop < length; loop++) {
  -//        Node currentNode = children.item(loop);
  -//
  -//        if (currentNode.getNodeType() == Node.ELEMENT_NODE) {
  -//          Element currentElement = (Element) currentNode;
  -//          String tagName = currentElement.getTagName();
  -//
  -//          if (tagName.equals(PARAM_TAG)) {
  -//            setParameter(currentElement, propSetter);
  -//          } else if (tagName.equals(APPENDER_REF_TAG)) {
  -//            eh.setBackupAppender(findAppenderByReference(currentElement));
  -//          } else if (tagName.equals(LOGGER_REF)) {
  -//            String loggerName = currentElement.getAttribute(REF_ATTR);
  -//            Logger logger = repository.getLogger(loggerName);
  -//            eh.setLogger(logger);
  -//          } else if (tagName.equals(ROOT_REF)) {
  -//            Logger root = repository.getRootLogger();
  -//            eh.setLogger(root);
  -//          }
  -//        }
  -//      }
  -//
  -//      if (eh instanceof OptionHandler) {
  -//        ((OptionHandler) eh).activateOptions();
  -//      }
  -//
  -//      appender.setErrorHandler(eh);
  -//    }
  -//  }
  -
  -  /**
  -     Used internally to parse a filter element.
  -   */
  -  protected void XXparseFilters(Element element, Appender appender) {
  -    String clazz = subst(element.getAttribute(CLASS_ATTR));
  -    Filter filter =
  -      (Filter) optionConverter.instantiateByClassName(
  -        clazz, Filter.class, null);
  -
  -    if (filter != null) {
  -      PropertySetter propSetter = new PropertySetter(filter);
  -      NodeList children = element.getChildNodes();
  -      final int length = children.getLength();
  -
  -      for (int loop = 0; loop < length; loop++) {
  -        Node currentNode = children.item(loop);
  -
  -        if (currentNode.getNodeType() == Node.ELEMENT_NODE) {
  -          Element currentElement = (Element) currentNode;
  -          String tagName = currentElement.getTagName();
  -
  -          if (tagName.equals(PARAM_TAG)) {
  -            setParameter(currentElement, propSetter);
  -          }
  -        }
  -      }
  -
  -      if (filter instanceof OptionHandler) {
  -        ((OptionHandler) filter).activateOptions();
  -      }
  -
  -      LogLog.debug(
  -        "Adding filter of type [" + filter.getClass()
  -        + "] to appender named [" + appender.getName() + "].");
  -      appender.addFilter(filter);
  -    }
  -  }
  -
  -  /**
  -     Used internally to parse an category element.
  -  */
  -  protected void parseCategory(Element loggerElement) {
  -    // Create a new org.apache.log4j.Category object from the <category> element.
  -    String catName = subst(loggerElement.getAttribute(NAME_ATTR));
  -
  -    Logger cat;
  -
  -    String className = subst(loggerElement.getAttribute(CLASS_ATTR));
  -
  -    if (EMPTY_STR.equals(className)) {
  -      LogLog.debug("Retreiving an instance of org.apache.log4j.Logger.");
  -      cat = repository.getLogger(catName);
  -    } else {
  -      LogLog.debug("Desired logger sub-class: [" + className + ']');
  -
  -      try {
  -        Class clazz = Loader.loadClass(className);
  -        Method getInstanceMethod =
  -          clazz.getMethod("getLogger", ONE_STRING_PARAM);
  -        cat =
  -          (Logger) getInstanceMethod.invoke(null, new Object[] { catName });
  -      } catch (Exception oops) {
  -        LogLog.error(
  -          "Could not retrieve category [" + catName
  -          + "]. Reported error follows.", oops);
  -
  -        return;
  -      }
  -    }
  -
  -    // Setting up a category needs to be an atomic operation, in order
  -    // to protect potential log operations while category
  -    // configuration is in progress.
  -    synchronized (cat) {
  -      boolean additivity =
  -        OptionConverter.toBoolean(
  -          subst(loggerElement.getAttribute(ADDITIVITY_ATTR)), true);
  -
  -      LogLog.debug(
  -        "Setting [" + cat.getName() + "] additivity to [" + additivity + "].");
  -      cat.setAdditivity(additivity);
  -      parseChildrenOfLoggerElement(loggerElement, cat, false);
  -    }
  -  }
  -
  -  /**
  -     Used internally to parse the root category element.
  -  */
  -  protected void parseRoot(Element rootElement) {
  -    Logger root = repository.getRootLogger();
  -
  -    // category configuration needs to be atomic
  -    synchronized (root) {
  -      parseChildrenOfLoggerElement(rootElement, root, true);
  -    }
  -  }
  -
  -  /**
  -     Used internally to parse the children of a category element.
  -  */
  -  protected void parseChildrenOfLoggerElement(
  -    Element catElement, Logger cat, boolean isRoot) {
  -    PropertySetter propSetter = new PropertySetter(cat);
  -
  -    // Remove all existing appenders from cat. They will be
  -    // reconstructed if need be.
  -    cat.removeAllAppenders();
  -
  -    NodeList children = catElement.getChildNodes();
  -    final int length = children.getLength();
  -
  -    for (int loop = 0; loop < length; loop++) {
  -      Node currentNode = children.item(loop);
  -
  -      if (currentNode.getNodeType() == Node.ELEMENT_NODE) {
  -        Element currentElement = (Element) currentNode;
  -        String tagName = currentElement.getTagName();
  -
  -        if (tagName.equals(APPENDER_REF_TAG)) {
  -          Element appenderRef = (Element) currentNode;
  -          Appender appender = findAppenderByReference(appenderRef);
  -          String refName = subst(appenderRef.getAttribute(REF_ATTR));
  -
  -          if (appender != null) {
  -            LogLog.debug(
  -              "Adding appender named [" + refName + "] to category ["
  -              + cat.getName() + "].");
  -          } else {
  -            LogLog.debug("Appender named [" + refName + "] not found.");
  -          }
  -
  -          cat.addAppender(appender);
  -        } else if (tagName.equals(LEVEL_TAG)) {
  -          parseLevel(currentElement, cat, isRoot);
  -        } else if (tagName.equals(PRIORITY_TAG)) {
  -          parseLevel(currentElement, cat, isRoot);
  -        } else if (tagName.equals(PARAM_TAG)) {
  -          setParameter(currentElement, propSetter);
  -        }
  -      }
  -    }
  -
  -    if (cat instanceof OptionHandler) {
  -      ((OptionHandler) cat).activateOptions();
  -    }
  -  }
  -
  -  protected void parseRenderer(Element element) {
  -    String renderingClass = subst(element.getAttribute(RENDERING_CLASS_ATTR));
  -    String renderedClass = subst(element.getAttribute(RENDERED_CLASS_ATTR));
  -
  -    if (repository instanceof RendererSupport) {
  -      RendererSupport rs = (RendererSupport) repository;
  -      RendererMap rm = rs.getRendererMap();
  -      rm.addRenderer(renderedClass, renderingClass);
  -    }
  -  }
  -
  -  /**
  -     Used internally to parse a level  element.
  -  */
  -  protected void parseLevel(Element element, Logger logger, boolean isRoot) {
  -    String catName = logger.getName();
  -
  -    if (isRoot) {
  -      catName = "root";
  -    }
  -
  -    String priStr = subst(element.getAttribute(VALUE_ATTR));
  -    LogLog.debug("Level value for " + catName + " is  [" + priStr + "].");
  -
  -    if (INHERITED.equalsIgnoreCase(priStr) || NULL.equalsIgnoreCase(priStr)) {
  -      if (isRoot) {
  -        LogLog.error("Root level cannot be inherited. Ignoring directive.");
  -      } else {
  -        logger.setLevel(null);
  -      }
  -    } else {
  -      String className = subst(element.getAttribute(CLASS_ATTR));
  -
  -      if (EMPTY_STR.equals(className)) {
  -        logger.setLevel(optionConverter.toLevel(priStr, Level.DEBUG));
  -      } else {
  -        LogLog.debug("Desired Level sub-class: [" + className + ']');
  -
  -        try {
  -          Class clazz = Loader.loadClass(className);
  -          Method toLevelMethod = clazz.getMethod("toLevel", ONE_STRING_PARAM);
  -          Level pri =
  -            (Level) toLevelMethod.invoke(null, new Object[] { priStr });
  -          logger.setLevel(pri);
  -        } catch (Exception oops) {
  -          LogLog.error(
  -            "Could not create level [" + priStr + "]. Reported error follows.",
  -            oops);
  -
  -          return;
  -        }
  -      }
  -    }
  -
  -    LogLog.debug(catName + " level set to " + logger.getLevel());
  -  }
  -
  -  protected Plugin parsePlugin(Element pluginElement) {
  -    String className = subst(pluginElement.getAttribute(CLASS_ATTR));
  -    LogLog.debug("Creating plugin: [" + className + ']');
  -
  -    try {
  -      Plugin plugin = (Plugin) Loader.loadClass(className).newInstance();
  -      PropertySetter propSetter = new PropertySetter(plugin);
  -
  -      plugin.setName(subst(pluginElement.getAttribute(NAME_ATTR)));
  -
  -      NodeList children = pluginElement.getChildNodes();
  -      final int length = children.getLength();
  -
  -      for (int loop = 0; loop < length; loop++) {
  -        Node currentNode = children.item(loop);
  -
  -        /* We're only interested in Elements */
  -        if (!isElement(currentNode)) {
  -          continue;
  -        }
  -
  -        Element currentElement = (Element) currentNode;
  -
  -        // Parse appender parameters 
  -        if (currentElement.getTagName().equals(PARAM_TAG)) {
  -          setParameter(currentElement, propSetter);
  -        }
  -      }
  -
  -      return plugin;
  -    } catch (Exception e) {
  -      LogLog.error("Could not create plugin. Reported error follows.", e);
  -
  -      return null;
  -    }
  -  }
  -
  -  protected void setParameter(Element elem, PropertySetter propSetter) {
  -    String name = subst(elem.getAttribute(NAME_ATTR));
  -    String value = (elem.getAttribute(VALUE_ATTR));
  -    value = subst(OptionConverter.convertSpecialChars(value));
  -    //LogLog.debug("*** value is "+value);
  -    propSetter.setProperty(name, value);
  -  }
  -
  -  /**
  -     Configure log4j using a <code>configuration</code> element as
  -     defined in the log4j.dtd.
  -
  -  */
  -  public static void configure(Element element) {
  -    DOMConfigurator configurator = new DOMConfigurator();
  -    configurator.doConfigure(element, LogManager.getLoggerRepository());
  -  }
  -
  -  public void doConfigure(String filename, LoggerRepository repository) {
  -    FileInputStream fis = null;
  -
  -    try {
  -      fis = new FileInputStream(filename);
  -      doConfigure(fis, repository);
  -    } catch (IOException e) {
  -      LogLog.error("Could not open [" + filename + "].", e);
  -    } finally {
  -      if (fis != null) {
  -        try {
  -          fis.close();
  -        } catch (java.io.IOException e) {
  -          LogLog.error("Could not close [" + filename + "].", e);
  -        }
  -      }
  -    }
  -  }
  -
  -  public void doConfigure(URL url, LoggerRepository repository) {
  -    try {
  -     InputStream in = url.openStream();
  -     doConfigure(in, repository);
  -     in.close();
  -    } catch (IOException e) {
  -      LogLog.error("Could not open [" + url + "].", e);
  -    }
  -  }
  -
  -  /**
  -     Configure log4j by reading in a log4j.dtd compliant XML
  -     configuration file.
  -
  -  */
  -  public void doConfigure(
  -    InputStream inputStream, LoggerRepository repository)
  -    throws FactoryConfigurationError {
  -    doConfigure(new InputSource(inputStream), repository);
  -  }
  -
  -  /**
  -     Configure log4j by reading in a log4j.dtd compliant XML
  -     configuration file.
  -
  -  */
  -  public void doConfigure(Reader reader, LoggerRepository repository)
  -    throws FactoryConfigurationError {
  -    doConfigure(new InputSource(reader), repository);
  -  }
  -
  -  /**
  -     Configure log4j by reading in a log4j.dtd compliant XML
  -     configuration file.
  -
  -  */
  -  protected void doConfigure(
  -    InputSource inputSource, LoggerRepository repository)
  -    throws FactoryConfigurationError {
  -    DocumentBuilderFactory dbf = null;
  -
  -    setLoggerRepository(repository);
  -
  -    try {
  -      LogLog.debug(
  -        "System property [" + dbfKey + "] is: "
  -        + OptionConverter.getSystemProperty(dbfKey, null));
  -      dbf = DocumentBuilderFactory.newInstance();
  -      LogLog.debug("Search for the standard DocumentBuilderFactory succeded.");
  -      LogLog.debug("DocumentBuilderFactory is: " + dbf.getClass().getName());
  -    } catch (FactoryConfigurationError fce) {
  -      Exception e = fce.getException();
  -      LogLog.debug("Could not instantiate a DocumentBuilderFactory.", e);
  -      throw fce;
  -    }
  -
  -    try {
  -      dbf.setValidating(true);
  -
  -      DocumentBuilder docBuilder = dbf.newDocumentBuilder();
  -      docBuilder.setErrorHandler(new SAXErrorHandler());
  -      docBuilder.setEntityResolver(new Log4jEntityResolver());
  -
  -      // we change the system ID to a valid URI so that Crimson won't
  -      // complain. Indeed, "log4j.dtd" alone is not a valid URI which
  -      // causes Crimson to barf. The Log4jEntityResolver only cares
  -      // about the "log4j.dtd" ending.
  -      inputSource.setSystemId("dummy://log4j.dtd");
  -
  -      Document doc = docBuilder.parse(inputSource);
  -      parse(doc.getDocumentElement());
  -    } catch (Exception e) {
  -      // I know this is miserable...
  -      LogLog.error("Could not parse input source [" + inputSource + "].", e);
  -    }
  -  }
  -
  -  /**
  -     Configure by taking in an DOM element.
  -   */
  -  public void doConfigure(Element element, LoggerRepository repository) {
  -    this.repository = repository;
  -    parse(element);
  -  }
  -
  -  /**
  -     A static version of {@link #doConfigure(String, LoggerRepository)}.  */
  -  public static void configure(String filename)
  -    throws FactoryConfigurationError {
  -    new DOMConfigurator().doConfigure(
  -      filename, LogManager.getLoggerRepository());
  -  }
  -
  -  /**
  -     A static version of {@link #doConfigure(URL, LoggerRepository)}.
  -   */
  -  public static void configure(URL url) throws FactoryConfigurationError {
  -    new DOMConfigurator().doConfigure(url, LogManager.getLoggerRepository());
  -  }
  -
  -  /**
  -     Used internally to configure the log4j framework by parsing a DOM
  -     tree of XML elements based on <a
  -     href="doc-files/log4j.dtd">log4j.dtd</a>.
  -
  -  */
  -  protected void parse(Element element) {
  -    String rootElementName = element.getTagName();
  -
  -    if (!rootElementName.equals(CONFIGURATION_TAG)) {
  -      if (rootElementName.equals(OLD_CONFIGURATION_TAG)) {
  -        LogLog.warn(
  -          "The <" + OLD_CONFIGURATION_TAG + "> element has been deprecated.");
  -        LogLog.warn("Use the <" + CONFIGURATION_TAG + "> element instead.");
  -      } else {
  -        LogLog.error(
  -          "DOM element is - not a <" + CONFIGURATION_TAG + "> element.");
  -
  -        return;
  -      }
  -    }
  -
  -    String debugAttrib = subst(element.getAttribute(INTERNAL_DEBUG_ATTR));
  -
  -    LogLog.debug("debug attribute= \"" + debugAttrib + "\".");
  -
  -    // if the log4j.dtd is not specified in the XML file, then the
  -    // "debug" attribute is returned as the empty string.
  -    if (!debugAttrib.equals("") && !debugAttrib.equals("null")) {
  -      LogLog.setInternalDebugging(
  -        OptionConverter.toBoolean(debugAttrib, true));
  -    } else {
  -      LogLog.debug("Ignoring " + INTERNAL_DEBUG_ATTR + " attribute.");
  -    }
  -
  -    String confDebug = subst(element.getAttribute(CONFIG_DEBUG_ATTR));
  -
  -    if (!confDebug.equals("") && !confDebug.equals("null")) {
  -      LogLog.warn(
  -        "The \"" + CONFIG_DEBUG_ATTR + "\" attribute is deprecated.");
  -      LogLog.warn(
  -        "Use the \"" + INTERNAL_DEBUG_ATTR + "\" attribute instead.");
  -      LogLog.setInternalDebugging(OptionConverter.toBoolean(confDebug, true));
  -    }
  -
  -    String thresholdStr = subst(element.getAttribute(THRESHOLD_ATTR));
  -    LogLog.debug("Threshold =\"" + thresholdStr + "\".");
  -
  -    if (!"".equals(thresholdStr) && !"null".equals(thresholdStr)) {
  -      repository.setThreshold(thresholdStr);
  -    }
  -
  -    //Hashtable appenderBag = new Hashtable(11);
  -
  -    /* Building Appender objects, placing them in a local namespace
  -       for future reference */
  -
  -    // First configure each category factory under the root element.
  -    // Category factories need to be configured before any of
  -    // categories they support.
  -    //
  -    String tagName = null;
  -    Element currentElement = null;
  -    Node currentNode = null;
  -    NodeList children = element.getChildNodes();
  -    final int length = children.getLength();
  -
  -    for (int loop = 0; loop < length; loop++) {
  -      currentNode = children.item(loop);
  -
  -      if (!isElement(currentNode)) {
  -        continue;
  -      }
  -
  -      currentElement = (Element) currentNode;
  -      tagName = currentElement.getTagName();
  -
  -      if (tagName.equals(CATEGORY) || tagName.equals(LOGGER)) {
  -        parseCategory(currentElement);
  -      } else if (tagName.equals(ROOT_TAG)) {
  -        parseRoot(currentElement);
  -      } else if (tagName.equals(RENDERER_TAG)) {
  -        parseRenderer(currentElement);
  -      } else if (tagName.equals(PLUGIN_TAG)) {
  -        Plugin plugin = parsePlugin(currentElement);
  -
  -        if (plugin != null) {
  -          repository.getPluginRegistry().addPlugin(plugin);
  -          plugin.activateOptions();
  -        }
  -      }
  -    }
  -
  -    // let listeners know the configuration just changed
  -    repository.fireConfigurationChangedEvent();
  -  }
  -
  -  protected String subst(String value) {
  -    try {
  -      return OptionConverter.substVars(value, props);
  -    } catch (IllegalArgumentException e) {
  -      LogLog.warn("Could not perform variable substitution.", e);
  -
  -      return value;
  -    }
  -  }
  -}
  -
  -
  -class XMLWatchdog extends FileWatchdog {
  -  XMLWatchdog(String filename) {
  -    super(filename);
  -  }
  -
  -  /**
  -     Call {@link PropertyConfigurator#configure(String)} with the
  -     <code>filename</code> to reconfigure log4j. */
  -  public void doOnChange() {
  -    new DOMConfigurator().doConfigure(
  -      filename, LogManager.getLoggerRepository());
  +  public static void configure(String file) {
  +    JoranConfigurator joran = new JoranConfigurator();
  +    joran.doConfigure(file, LogManager.getLoggerRepository());
     }
  +  
   }
  
  
  
  1.33      +2 -1      logging-log4j/src/java/org/apache/log4j/joran/JoranConfigurator.java
  
  Index: JoranConfigurator.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/joran/JoranConfigurator.java,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- JoranConfigurator.java	5 Jan 2005 17:16:11 -0000	1.32
  +++ JoranConfigurator.java	6 Jan 2005 19:27:04 -0000	1.33
  @@ -230,7 +230,8 @@
       rs.addRule(new Pattern("*/param"), new ParamAction());
   
       joranInterpreter = new Interpreter(rs);
  -
  +    joranInterpreter.setLoggerRepository(repository);
  +    
       // The following line adds the capability to parse nested components
       joranInterpreter.addImplicitAction(new NestComponentIA());
       ExecutionContext ec = joranInterpreter.getExecutionContext();
  
  
  

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