logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From carn...@apache.org
Subject svn commit: r365293 - in /logging/log4j/trunk: src/java/org/apache/log4j/ src/java/org/apache/log4j/db/ src/java/org/apache/log4j/helpers/ src/java/org/apache/log4j/joran/action/ src/java/org/apache/log4j/plugins/ src/java/org/apache/log4j/selector/ser...
Date Mon, 02 Jan 2006 05:10:54 GMT
Author: carnold
Date: Sun Jan  1 21:10:42 2006
New Revision: 365293

URL: http://svn.apache.org/viewcvs?rev=365293&view=rev
Log:
Bug 35452: Revert LoggerRepository, add LoggerRepositoryEx for new methods

Added:
    logging/log4j/trunk/src/java/org/apache/log4j/spi/HierarchyEventListenerAdapter.java
    logging/log4j/trunk/src/java/org/apache/log4j/spi/LoggerRepositoryEx.java
Modified:
    logging/log4j/trunk/src/java/org/apache/log4j/HTMLLayout.java
    logging/log4j/trunk/src/java/org/apache/log4j/Hierarchy.java
    logging/log4j/trunk/src/java/org/apache/log4j/LogManager.java
    logging/log4j/trunk/src/java/org/apache/log4j/PatternLayout.java
    logging/log4j/trunk/src/java/org/apache/log4j/PropertyConfigurator.java
    logging/log4j/trunk/src/java/org/apache/log4j/db/CustomSQLDBReceiver.java
    logging/log4j/trunk/src/java/org/apache/log4j/db/DBReceiver.java
    logging/log4j/trunk/src/java/org/apache/log4j/helpers/IntializationUtil.java
    logging/log4j/trunk/src/java/org/apache/log4j/joran/action/ConversionRuleAction.java
    logging/log4j/trunk/src/java/org/apache/log4j/joran/action/PluginAction.java
    logging/log4j/trunk/src/java/org/apache/log4j/joran/action/RepositoryPropertyAction.java
    logging/log4j/trunk/src/java/org/apache/log4j/plugins/PluginRegistry.java
    logging/log4j/trunk/src/java/org/apache/log4j/selector/servlet/ContextDetachingSCL.java
    logging/log4j/trunk/src/java/org/apache/log4j/spi/HierarchyEventListener.java
    logging/log4j/trunk/src/java/org/apache/log4j/spi/LoggerRepository.java
    logging/log4j/trunk/src/java/org/apache/log4j/spi/LoggingEvent.java
    logging/log4j/trunk/src/java/org/apache/log4j/spi/RootCategory.java
    logging/log4j/trunk/src/java/org/apache/log4j/spi/RootLogger.java
    logging/log4j/trunk/src/java/org/apache/log4j/watchdog/TimedURLWatchdog.java
    logging/log4j/trunk/tests/src/java/org/apache/log4j/db/FullCycleDBTest.java
    logging/log4j/trunk/tests/src/java/org/apache/log4j/joran/InterpreterTest.java
    logging/log4j/trunk/tests/src/java/org/apache/log4j/plugins/PluginTestCase.java
    logging/log4j/trunk/tests/src/java/org/apache/log4j/watchdog/FileWatchdogTestCase.java

Modified: logging/log4j/trunk/src/java/org/apache/log4j/HTMLLayout.java
URL: http://svn.apache.org/viewcvs/logging/log4j/trunk/src/java/org/apache/log4j/HTMLLayout.java?rev=365293&r1=365292&r2=365293&view=diff
==============================================================================
--- logging/log4j/trunk/src/java/org/apache/log4j/HTMLLayout.java (original)
+++ logging/log4j/trunk/src/java/org/apache/log4j/HTMLLayout.java Sun Jan  1 21:10:42 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999,2004 The Apache Software Foundation.
+ * Copyright 1999,2006 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.
@@ -17,7 +17,13 @@
 package org.apache.log4j;
 
 import org.apache.log4j.helpers.Transform;
-import org.apache.log4j.pattern.*;
+import org.apache.log4j.pattern.FormattingInfo;
+import org.apache.log4j.pattern.LiteralPatternConverter;
+import org.apache.log4j.pattern.LoggingEventPatternConverter;
+import org.apache.log4j.pattern.PatternConverter;
+import org.apache.log4j.pattern.PatternParser;
+import org.apache.log4j.spi.LoggerRepository;
+import org.apache.log4j.spi.LoggerRepositoryEx;
 import org.apache.log4j.spi.LoggingEvent;
 
 import java.util.ArrayList;
@@ -35,7 +41,6 @@
  * 
  * @author Ceki Gülcü
  * @author Steve Mactaggart
- * @version 1.3
  */
 public class HTMLLayout extends Layout {
   /**
@@ -165,8 +170,8 @@
       List converters = new ArrayList();
       List fields = new ArrayList();
       Map converterRegistry = null;
-      if(this.repository != null) {
-          converterRegistry = (Map) this.repository.getObject(PATTERN_RULE_REGISTRY);
+      if(this.repository instanceof LoggerRepositoryEx) {
+          converterRegistry = (Map) ((LoggerRepositoryEx) repository).getObject(PATTERN_RULE_REGISTRY);
       }
       PatternParser.parse(pattern, converters, fields,
               converterRegistry, PatternParser.getPatternLayoutRules(), getLogger());
@@ -291,12 +296,16 @@
     sbuf.append(Layout.LINE_SEP);
     sbuf.append("<head>");
     sbuf.append(Layout.LINE_SEP);
-    sbuf.append("<title>" + title + "</title>");
+    sbuf.append("<title>");
+    sbuf.append(title);
+    sbuf.append("</title>");
     sbuf.append(Layout.LINE_SEP);
     if(internalCSS) {
       getInternalCSS(sbuf);
     } else {
-      sbuf.append("<LINK REL=StyleSheet HREF=\""+url2ExternalCSS+"\" TITLE=\"Basic\">");
+      sbuf.append("<LINK REL=StyleSheet HREF=\"");
+      sbuf.append(url2ExternalCSS);
+      sbuf.append("\" TITLE=\"Basic\">");
     }
     sbuf.append(Layout.LINE_SEP);
     sbuf.append("</head>");
@@ -307,7 +316,9 @@
     sbuf.append("<hr size=\"1\" noshade>");
     sbuf.append(Layout.LINE_SEP);
     
-    sbuf.append("Log session start time " + new java.util.Date() + "<br>");
+    sbuf.append("Log session start time ");
+    sbuf.append(new java.util.Date());
+    sbuf.append("<br>");
     sbuf.append(Layout.LINE_SEP);
     sbuf.append("<br>");
     sbuf.append(Layout.LINE_SEP);
@@ -337,8 +348,10 @@
    */
   public String getFooter() {
     StringBuffer sbuf = new StringBuffer();
-    sbuf.append("</table>" + Layout.LINE_SEP);
-    sbuf.append("<br>" + Layout.LINE_SEP);
+    sbuf.append("</table>");
+    sbuf.append(Layout.LINE_SEP);
+    sbuf.append("<br>");
+    sbuf.append(Layout.LINE_SEP);
     sbuf.append("</body></html>");
     return sbuf.toString();
   }
@@ -352,7 +365,7 @@
   }
 
   /**
-   * {@inheritDoc}
+   * @{inheritDoc}
    */
   public String format(LoggingEvent event) {
     

Modified: logging/log4j/trunk/src/java/org/apache/log4j/Hierarchy.java
URL: http://svn.apache.org/viewcvs/logging/log4j/trunk/src/java/org/apache/log4j/Hierarchy.java?rev=365293&r1=365292&r2=365293&view=diff
==============================================================================
--- logging/log4j/trunk/src/java/org/apache/log4j/Hierarchy.java (original)
+++ logging/log4j/trunk/src/java/org/apache/log4j/Hierarchy.java Sun Jan  1 21:10:42 2006
@@ -20,7 +20,6 @@
 // WARNING directly nor indirectly.
 package org.apache.log4j;
 
-import org.apache.log4j.Appender;
 import org.apache.log4j.helpers.IntializationUtil;
 import org.apache.log4j.helpers.LogLog;
 import org.apache.log4j.or.ObjectRenderer;
@@ -30,7 +29,7 @@
 import org.apache.log4j.spi.ErrorItem;
 import org.apache.log4j.spi.LoggerEventListener;
 import org.apache.log4j.spi.LoggerFactory;
-import org.apache.log4j.spi.LoggerRepository;
+import org.apache.log4j.spi.LoggerRepositoryEx;
 import org.apache.log4j.spi.LoggerRepositoryEventListener;
 import org.apache.log4j.spi.RendererSupport;
 
@@ -71,10 +70,10 @@
    @author Mark Womack
 
 */
-public class Hierarchy implements LoggerRepository, RendererSupport {
+public class Hierarchy implements LoggerRepositoryEx, RendererSupport {
   private LoggerFactory defaultFactory;
-  private ArrayList repositoryEventListeners;
-  private ArrayList loggerEventListeners;
+  private final ArrayList repositoryEventListeners;
+  private final ArrayList loggerEventListeners;
   String name;
   Hashtable ht;
   Logger root;
@@ -84,16 +83,16 @@
   PluginRegistry pluginRegistry;
   Map properties;
   private Scheduler scheduler;
-  
+
   // The repository can also be used as an object store for various objects used
   // by log4j components
   private Map objectMap;
-  
+
   // the internal logger used by this instance of Hierarchy for its own reporting
   private Logger myLogger;
-  
+
   private List errorList = new Vector();
-  
+
   boolean emittedNoAppenderWarning = false;
   boolean emittedNoResourceBundleWarning = false;
   boolean pristine = true;
@@ -135,7 +134,7 @@
     synchronized (repositoryEventListeners) {
       if (repositoryEventListeners.contains(listener)) {
         getMyLogger().warn(
-          "Ignoring attempt to add a previously registerd LoggerRepositoryEventListener.");
+          "Ignoring attempt to add a previously registered LoggerRepositoryEventListener.");
       } else {
         repositoryEventListeners.add(listener);
       }
@@ -148,7 +147,7 @@
     }
     return myLogger;
   }
-  
+
   /**
     Remove a {@link LoggerRepositoryEventListener} from the repository.
     @since 1.3*/
@@ -179,6 +178,16 @@
     }
   }
 
+    /**
+       Add a {@link org.apache.log4j.spi.HierarchyEventListener} event to the repository.
+       @deprecated Superceded by addLoggerEventListener
+    */
+    public
+    void addHierarchyEventListener(final org.apache.log4j.spi.HierarchyEventListener listener) {
+        addLoggerEventListener(new org.apache.log4j.spi.HierarchyEventListenerAdapter(listener));
+    }
+
+
   /**
     Remove a {@link LoggerEventListener} from the repository.
     @since 1.3*/
@@ -255,9 +264,9 @@
     }
   }
 
-  /* 
+  /*
    * Get the properties for this repository.
-   * 
+   *
    * @see org.apache.log4j.spi.LoggerRepository#getProperties()
    *
    */
@@ -265,7 +274,7 @@
     return properties;
   }
 
-  /* 
+  /*
    * Get a property of this repository.
    * @see org.apache.log4j.spi.LoggerRepository#getProperty(java.lang.String)
    */
@@ -273,7 +282,7 @@
      return (String) properties.get(key);
   }
 
-  /* 
+  /*
    * Set a property by key and value. The property will be shared by all
    * events in this repository.
    */
@@ -542,15 +551,15 @@
   public List getErrorList() {
     return errorList;
   }
-  
+
   /**
    * Add an error item to the list of previously encountered errors.
-   * @since 1.3 
+   * @since 1.3
    */
   public void addErrorItem(ErrorItem errorItem) {
     getErrorList().add(errorItem);
   }
-  
+
   /**
      @deprecated Please use {@link #getCurrentLoggers} instead.
    */
@@ -671,13 +680,13 @@
   }
 
   private void shutdown(boolean doingReset) {
-    
+
     // stop this repo's scheduler if it has one
      if(scheduler != null) {
        scheduler.shutdown();
        scheduler = null;
      }
-    
+
     // let listeners know about shutdown if this is
     // not being done as part of a reset.
     if (!doingReset) {

Modified: logging/log4j/trunk/src/java/org/apache/log4j/LogManager.java
URL: http://svn.apache.org/viewcvs/logging/log4j/trunk/src/java/org/apache/log4j/LogManager.java?rev=365293&r1=365292&r2=365293&view=diff
==============================================================================
--- logging/log4j/trunk/src/java/org/apache/log4j/LogManager.java (original)
+++ logging/log4j/trunk/src/java/org/apache/log4j/LogManager.java Sun Jan  1 21:10:42 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999,2005 The Apache Software Foundation.
+ * Copyright 1999,2006 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.
@@ -117,8 +117,9 @@
             System.out.println("**Start of LogManager static initializer");
         }
 
-        defaultLoggerRepository = new Hierarchy(new RootLogger(Level.DEBUG));
-        defaultLoggerRepository.setName(Constants.DEFAULT_REPOSITORY_NAME);
+        Hierarchy hierarchy =  new Hierarchy(new RootLogger(Level.DEBUG));
+        defaultLoggerRepository = hierarchy;
+        hierarchy.setName(Constants.DEFAULT_REPOSITORY_NAME);
         
         // temporary repository
         repositorySelector = new DefaultRepositorySelector(defaultLoggerRepository);

Modified: logging/log4j/trunk/src/java/org/apache/log4j/PatternLayout.java
URL: http://svn.apache.org/viewcvs/logging/log4j/trunk/src/java/org/apache/log4j/PatternLayout.java?rev=365293&r1=365292&r2=365293&view=diff
==============================================================================
--- logging/log4j/trunk/src/java/org/apache/log4j/PatternLayout.java (original)
+++ logging/log4j/trunk/src/java/org/apache/log4j/PatternLayout.java Sun Jan  1 21:10:42 2006
@@ -22,9 +22,8 @@
 import org.apache.log4j.pattern.LoggingEventPatternConverter;
 import org.apache.log4j.pattern.PatternParser;
 import org.apache.log4j.spi.LoggingEvent;
+import org.apache.log4j.spi.LoggerRepositoryEx;
 
-import java.io.IOException;
-import java.io.Writer;
 
 import java.util.ArrayList;
 import java.util.Iterator;
@@ -513,8 +512,10 @@
     Map converterRegistry = null;
 
     if (this.repository != null) {
-      converterRegistry =
-        (Map) this.repository.getObject(PATTERN_RULE_REGISTRY);
+      if (repository instanceof LoggerRepositoryEx) {
+        converterRegistry =
+            (Map) ((LoggerRepositoryEx) repository).getObject(PATTERN_RULE_REGISTRY);
+      }
     }
 
     PatternParser.parse(

Modified: logging/log4j/trunk/src/java/org/apache/log4j/PropertyConfigurator.java
URL: http://svn.apache.org/viewcvs/logging/log4j/trunk/src/java/org/apache/log4j/PropertyConfigurator.java?rev=365293&r1=365292&r2=365293&view=diff
==============================================================================
--- logging/log4j/trunk/src/java/org/apache/log4j/PropertyConfigurator.java (original)
+++ logging/log4j/trunk/src/java/org/apache/log4j/PropertyConfigurator.java Sun Jan  1 21:10:42 2006
@@ -19,7 +19,6 @@
 //               Anders Kristensen <akristensen@dynamicsoft.com>
 package org.apache.log4j;
 
-import org.apache.log4j.DefaultCategoryFactory;
 import org.apache.log4j.config.ConfiguratorBase;
 import org.apache.log4j.config.PropertySetter;
 import org.apache.log4j.helpers.OptionConverter;
@@ -28,6 +27,7 @@
 import org.apache.log4j.spi.ErrorItem;
 import org.apache.log4j.spi.LoggerFactory;
 import org.apache.log4j.spi.LoggerRepository;
+import org.apache.log4j.spi.LoggerRepositoryEx;
 
 //import org.apache.log4j.config.PropertySetterException;
 import org.apache.log4j.spi.OptionHandler;
@@ -367,7 +367,9 @@
 
       // As soon as we start configuration process, the pristine flag is set to 
       // false.
-      repository.setPristine(false);
+      if(repository instanceof LoggerRepositoryEx) {
+        ((LoggerRepositoryEx) repository).setPristine(false);
+      }
 
       
       String thresholdStr =

Modified: logging/log4j/trunk/src/java/org/apache/log4j/db/CustomSQLDBReceiver.java
URL: http://svn.apache.org/viewcvs/logging/log4j/trunk/src/java/org/apache/log4j/db/CustomSQLDBReceiver.java?rev=365293&r1=365292&r2=365293&view=diff
==============================================================================
--- logging/log4j/trunk/src/java/org/apache/log4j/db/CustomSQLDBReceiver.java (original)
+++ logging/log4j/trunk/src/java/org/apache/log4j/db/CustomSQLDBReceiver.java Sun Jan  1 21:10:42 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999,2004 The Apache Software Foundation.
+ * Copyright 1999,2006 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.
@@ -30,6 +30,7 @@
 import org.apache.log4j.scheduler.Job;
 import org.apache.log4j.scheduler.Scheduler;
 import org.apache.log4j.spi.LoggingEvent;
+import org.apache.log4j.spi.LoggerRepositoryEx;
 import org.apache.log4j.spi.ThrowableInformation;
 import org.apache.log4j.spi.LocationInfo;
 
@@ -175,11 +176,13 @@
       }
      
     
+
+      if (repository instanceof LoggerRepositoryEx) {
+        Scheduler scheduler = ((LoggerRepositoryEx) repository).getScheduler();
       
-      Scheduler scheduler = this.repository.getScheduler();
-      
-      scheduler.schedule(
+        scheduler.schedule(
           customReceiverJob, System.currentTimeMillis() + 500, refreshMillis);
+      }
 
     }
 
@@ -241,8 +244,8 @@
     public void shutdown() {
         getLogger().info("removing receiverJob from the Scheduler.");
 
-        if(this.repository != null) {
-          Scheduler scheduler = repository.getScheduler();
+        if(this.repository instanceof LoggerRepositoryEx) {
+          Scheduler scheduler = ((LoggerRepositoryEx) repository).getScheduler();
           scheduler.delete(customReceiverJob);
         }
 

Modified: logging/log4j/trunk/src/java/org/apache/log4j/db/DBReceiver.java
URL: http://svn.apache.org/viewcvs/logging/log4j/trunk/src/java/org/apache/log4j/db/DBReceiver.java?rev=365293&r1=365292&r2=365293&view=diff
==============================================================================
--- logging/log4j/trunk/src/java/org/apache/log4j/db/DBReceiver.java (original)
+++ logging/log4j/trunk/src/java/org/apache/log4j/db/DBReceiver.java Sun Jan  1 21:10:42 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999,2004 The Apache Software Foundation.
+ * Copyright 1999,2006 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.
@@ -20,6 +20,7 @@
 import org.apache.log4j.plugins.Receiver;
 import org.apache.log4j.scheduler.Scheduler;
 import org.apache.log4j.spi.LoggerRepository;
+import org.apache.log4j.spi.LoggerRepositoryEx;
 
 /**
  *
@@ -54,10 +55,12 @@
       "DBAppender cannot function without a reference to its owning repository");
     }
 
-    Scheduler scheduler = this.repository.getScheduler();
+    if (repository instanceof LoggerRepositoryEx) {
+        Scheduler scheduler = ((LoggerRepositoryEx) repository).getScheduler();
     
-    scheduler.schedule(
-        receiverJob, System.currentTimeMillis() + 500, refreshMillis);
+        scheduler.schedule(
+            receiverJob, System.currentTimeMillis() + 500, refreshMillis);
+    }
    
   }
 
@@ -92,8 +95,8 @@
   public void shutdown() {
     getLogger().info("removing receiverJob from the Scheduler.");
 
-    if(this.repository != null) {
-      Scheduler scheduler = repository.getScheduler();
+    if(this.repository instanceof LoggerRepositoryEx) {
+      Scheduler scheduler = ((LoggerRepositoryEx) repository).getScheduler();
       scheduler.delete(receiverJob);
     }
   }

Modified: logging/log4j/trunk/src/java/org/apache/log4j/helpers/IntializationUtil.java
URL: http://svn.apache.org/viewcvs/logging/log4j/trunk/src/java/org/apache/log4j/helpers/IntializationUtil.java?rev=365293&r1=365292&r2=365293&view=diff
==============================================================================
--- logging/log4j/trunk/src/java/org/apache/log4j/helpers/IntializationUtil.java (original)
+++ logging/log4j/trunk/src/java/org/apache/log4j/helpers/IntializationUtil.java Sun Jan  1 21:10:42 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999,2004 The Apache Software Foundation.
+ * Copyright 1999,2006 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.
@@ -16,9 +16,8 @@
 
 package org.apache.log4j.helpers;
 
-import org.apache.log4j.helpers.Loader;
-import org.apache.log4j.helpers.OptionConverter;
 import org.apache.log4j.spi.LoggerRepository;
+import org.apache.log4j.spi.LoggerRepositoryEx;
 
 import java.net.MalformedURLException;
 import java.net.URL;
@@ -78,11 +77,17 @@
     // configuration to the OptionConverter.selectAndConfigure
     // method.
     if (url != null) {
-      LogLog.info(
-        "Using URL [" + url 
-          + "] for automatic log4j configuration of repository named ["+
-          repository.getName()+"].");
-      
+      if (repository instanceof LoggerRepositoryEx) {
+        LogLog.info(
+            "Using URL [" + url
+            + "] for automatic log4j configuration of repository named ["+
+            ((LoggerRepositoryEx) repository).getName()+"].");
+      } else {
+          LogLog.info(
+              "Using URL [" + url
+              + "] for automatic log4j configuration of unnamed repository.");
+      }
+
       OptionConverter.selectAndConfigure(url, configuratorClassNameStr, repository);
     }
   }

Modified: logging/log4j/trunk/src/java/org/apache/log4j/joran/action/ConversionRuleAction.java
URL: http://svn.apache.org/viewcvs/logging/log4j/trunk/src/java/org/apache/log4j/joran/action/ConversionRuleAction.java?rev=365293&r1=365292&r2=365293&view=diff
==============================================================================
--- logging/log4j/trunk/src/java/org/apache/log4j/joran/action/ConversionRuleAction.java (original)
+++ logging/log4j/trunk/src/java/org/apache/log4j/joran/action/ConversionRuleAction.java Sun Jan  1 21:10:42 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999,2004 The Apache Software Foundation.
+ * Copyright 1999,2006 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.
@@ -26,6 +26,7 @@
 import org.apache.log4j.joran.spi.ExecutionContext;
 import org.apache.log4j.spi.ErrorItem;
 import org.apache.log4j.spi.LoggerRepository;
+import org.apache.log4j.spi.LoggerRepositoryEx;
 
 
 import org.xml.sax.Attributes;
@@ -73,10 +74,12 @@
 
       LoggerRepository repository = (LoggerRepository) ec.getObjectStack().get(0);
 
-      Map ruleRegistry = (Map) repository.getObject(PatternLayout.PATTERN_RULE_REGISTRY);
+      //
+      //   cast may fail with user supplied repository
+      Map ruleRegistry = (Map) ((LoggerRepositoryEx) repository).getObject(PatternLayout.PATTERN_RULE_REGISTRY);
       if(ruleRegistry == null) {
         ruleRegistry = new HashMap();
-        repository.putObject(PatternLayout.PATTERN_RULE_REGISTRY, ruleRegistry);
+        ((LoggerRepositoryEx) repository).putObject(PatternLayout.PATTERN_RULE_REGISTRY, ruleRegistry);
       }
       // put the new rule into the rule registry
       ruleRegistry.put(conversionWord, converterClass);

Modified: logging/log4j/trunk/src/java/org/apache/log4j/joran/action/PluginAction.java
URL: http://svn.apache.org/viewcvs/logging/log4j/trunk/src/java/org/apache/log4j/joran/action/PluginAction.java?rev=365293&r1=365292&r2=365293&view=diff
==============================================================================
--- logging/log4j/trunk/src/java/org/apache/log4j/joran/action/PluginAction.java (original)
+++ logging/log4j/trunk/src/java/org/apache/log4j/joran/action/PluginAction.java Sun Jan  1 21:10:42 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999,2004 The Apache Software Foundation.
+ * Copyright 1999,2006 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.
@@ -22,6 +22,7 @@
 import org.apache.log4j.plugins.Plugin;
 import org.apache.log4j.spi.ErrorItem;
 import org.apache.log4j.spi.LoggerRepository;
+import org.apache.log4j.spi.LoggerRepositoryEx;
 import org.apache.log4j.spi.OptionHandler;
 
 import org.xml.sax.Attributes;
@@ -59,9 +60,12 @@
       }
 
       LoggerRepository repository = (LoggerRepository) ec.getObject(0);
-      
-      repository.getPluginRegistry().addPlugin(plugin);
-	    plugin.setLoggerRepository(repository);
+
+      //
+      //   cast may fail when using user supplied repository
+      //
+      ((LoggerRepositoryEx) repository).getPluginRegistry().addPlugin(plugin);
+	  plugin.setLoggerRepository(repository);
       
       getLogger().debug("Pushing plugin on to the object stack.");
       ec.pushObject(plugin);

Modified: logging/log4j/trunk/src/java/org/apache/log4j/joran/action/RepositoryPropertyAction.java
URL: http://svn.apache.org/viewcvs/logging/log4j/trunk/src/java/org/apache/log4j/joran/action/RepositoryPropertyAction.java?rev=365293&r1=365292&r2=365293&view=diff
==============================================================================
--- logging/log4j/trunk/src/java/org/apache/log4j/joran/action/RepositoryPropertyAction.java (original)
+++ logging/log4j/trunk/src/java/org/apache/log4j/joran/action/RepositoryPropertyAction.java Sun Jan  1 21:10:42 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999,2004 The Apache Software Foundation.
+ * Copyright 1999,2006 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.
@@ -19,6 +19,7 @@
 
 import org.apache.log4j.joran.spi.ExecutionContext;
 import org.apache.log4j.spi.LoggerRepository;
+import org.apache.log4j.spi.LoggerRepositoryEx;
 
 /**
  * @author ceki
@@ -33,12 +34,15 @@
     if(repository == null) {
       
     }
-    
-    repository.getProperties().putAll(props);
+    if (repository instanceof LoggerRepositoryEx) {
+        ((LoggerRepositoryEx) repository).getProperties().putAll(props);
+    }
   }
   
   public void setProperty(ExecutionContext ec, String key, String value) {
     LoggerRepository repository = getLoggerRepository();
-    repository.setProperty(key, value);
+    if (repository instanceof LoggerRepositoryEx) {
+        ((LoggerRepositoryEx) repository).setProperty(key, value);
+    }
   }
 }

Modified: logging/log4j/trunk/src/java/org/apache/log4j/plugins/PluginRegistry.java
URL: http://svn.apache.org/viewcvs/logging/log4j/trunk/src/java/org/apache/log4j/plugins/PluginRegistry.java?rev=365293&r1=365292&r2=365293&view=diff
==============================================================================
--- logging/log4j/trunk/src/java/org/apache/log4j/plugins/PluginRegistry.java (original)
+++ logging/log4j/trunk/src/java/org/apache/log4j/plugins/PluginRegistry.java Sun Jan  1 21:10:42 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999,2004 The Apache Software Foundation.
+ * Copyright 1999,2006 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.
@@ -23,6 +23,7 @@
 import java.util.Map;
 
 import org.apache.log4j.spi.LoggerRepository;
+import org.apache.log4j.spi.LoggerRepositoryEx;
 import org.apache.log4j.spi.LoggerRepositoryEventListener;
 
 
@@ -41,7 +42,7 @@
    * key=plugin.getName, value=plugin
    */
   private final Map pluginMap;
-  private final LoggerRepository loggerRepository;
+  private final LoggerRepositoryEx loggerRepository;
 
   /**
    * the listener used to listen for repository events.
@@ -49,13 +50,13 @@
   private final RepositoryListener listener = new RepositoryListener();
   private final List listenerList = Collections.synchronizedList(new ArrayList());
 
-  public PluginRegistry(LoggerRepository loggerRepository) {
+  public PluginRegistry(LoggerRepositoryEx loggerRepository) {
     pluginMap = new HashMap();
     this.loggerRepository = loggerRepository;
     this.loggerRepository.addLoggerRepositoryEventListener(listener);
   }
 
-  public LoggerRepository getLoggerRepository() {
+  public LoggerRepositoryEx getLoggerRepository() {
     return loggerRepository;
   }
 
@@ -77,7 +78,7 @@
   /**
    * Adds a plugin to the plugin registry. If a plugin with the same name exists
    * already, it is shutdown and removed.
-   *  
+   *
    * @param plugin the plugin to add.
    * */
   public void addPlugin(Plugin plugin) {
@@ -87,7 +88,7 @@
 
       // make sure the plugin has reference to repository
       plugin.setLoggerRepository(getLoggerRepository());
-      
+
       Plugin existingPlugin = (Plugin)pluginMap.get(name);
       if (existingPlugin != null) {
         existingPlugin.shutdown();

Modified: logging/log4j/trunk/src/java/org/apache/log4j/selector/servlet/ContextDetachingSCL.java
URL: http://svn.apache.org/viewcvs/logging/log4j/trunk/src/java/org/apache/log4j/selector/servlet/ContextDetachingSCL.java?rev=365293&r1=365292&r2=365293&view=diff
==============================================================================
--- logging/log4j/trunk/src/java/org/apache/log4j/selector/servlet/ContextDetachingSCL.java (original)
+++ logging/log4j/trunk/src/java/org/apache/log4j/selector/servlet/ContextDetachingSCL.java Sun Jan  1 21:10:42 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999,2004 The Apache Software Foundation.
+ * Copyright 1999,2006 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.
@@ -21,6 +21,7 @@
 import org.apache.log4j.helpers.Constants;
 import org.apache.log4j.helpers.JNDIUtil;
 import org.apache.log4j.spi.LoggerRepository;
+import org.apache.log4j.spi.LoggerRepositoryEx;
 import org.apache.log4j.spi.RepositorySelector;
 
 import javax.naming.Context;
@@ -75,7 +76,12 @@
       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());
+        if (lr instanceof LoggerRepositoryEx) {
+            logger.debug("About to shutdown logger repository named [{}]",
+                    ((LoggerRepositoryEx) lr).getName());
+        } else {
+            logger.debug("About to shutdown unnamed logger repository");
+        }
         lr.shutdown();
       }
     }

Modified: logging/log4j/trunk/src/java/org/apache/log4j/spi/HierarchyEventListener.java
URL: http://svn.apache.org/viewcvs/logging/log4j/trunk/src/java/org/apache/log4j/spi/HierarchyEventListener.java?rev=365293&r1=365292&r2=365293&view=diff
==============================================================================
--- logging/log4j/trunk/src/java/org/apache/log4j/spi/HierarchyEventListener.java (original)
+++ logging/log4j/trunk/src/java/org/apache/log4j/spi/HierarchyEventListener.java Sun Jan  1 21:10:42 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999,2004 The Apache Software Foundation.
+ * Copyright 1999,2006 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.
@@ -16,7 +16,8 @@
 
 package org.apache.log4j.spi;
 
-import org.apache.log4j.*;
+import org.apache.log4j.Appender;
+import org.apache.log4j.Category;
 
 
 /**
@@ -25,6 +26,7 @@
 
    @author Ceki G&uuml;lc&uuml;
    @since 1.2
+   @deprecated Superceded by LoggerEventListener.
 
  */
 public interface HierarchyEventListener {

Added: logging/log4j/trunk/src/java/org/apache/log4j/spi/HierarchyEventListenerAdapter.java
URL: http://svn.apache.org/viewcvs/logging/log4j/trunk/src/java/org/apache/log4j/spi/HierarchyEventListenerAdapter.java?rev=365293&view=auto
==============================================================================
--- logging/log4j/trunk/src/java/org/apache/log4j/spi/HierarchyEventListenerAdapter.java (added)
+++ logging/log4j/trunk/src/java/org/apache/log4j/spi/HierarchyEventListenerAdapter.java Sun Jan  1 21:10:42 2006
@@ -0,0 +1,75 @@
+/*
+ * Copyright 1999,2006 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.log4j.spi;
+
+import org.apache.log4j.Appender;
+import org.apache.log4j.Logger;
+
+
+/**
+ * Adapter class that wraps an object that implements
+ * HierarchyEventListener and exposes the log4j 1.3 introduced
+ * LoggerEventListener interface.
+ *
+ * @deprecated
+ */
+public final class HierarchyEventListenerAdapter implements LoggerEventListener {
+  /**
+   * Wrapped listener.
+   */
+  private final org.apache.log4j.spi.HierarchyEventListener listener;
+
+  /**
+   * Constructs a new instance of HierarchyEventListenerAdapter.
+   * @param listener
+   * @deprecated
+   */
+  public HierarchyEventListenerAdapter(
+    final org.apache.log4j.spi.HierarchyEventListener listener) {
+    if (listener == null) {
+      throw new IllegalArgumentException("listener");
+    }
+
+    this.listener = listener;
+  }
+
+  /**
+    Called when an appender is added to the logger.
+
+    @param logger The logger to which the appender was added.
+    @param appender The appender added to the logger. */
+  public void appenderAddedEvent(final Logger logger, final Appender appender) {
+    listener.addAppenderEvent(logger, appender);
+  }
+
+  /**
+    Called when an appender is removed from the logger.
+
+    @param logger The logger from which the appender was removed.
+    @param appender The appender removed from the logger. */
+  public void appenderRemovedEvent(
+    final Logger logger, final Appender appender) {
+    listener.removeAppenderEvent(logger, appender);
+  }
+
+  /**
+    Called when level changed on the logger.
+
+    @param logger The logger that changed levels. */
+  public void levelChangedEvent(final Logger logger) {
+  }
+}

Modified: logging/log4j/trunk/src/java/org/apache/log4j/spi/LoggerRepository.java
URL: http://svn.apache.org/viewcvs/logging/log4j/trunk/src/java/org/apache/log4j/spi/LoggerRepository.java?rev=365293&r1=365292&r2=365293&view=diff
==============================================================================
--- logging/log4j/trunk/src/java/org/apache/log4j/spi/LoggerRepository.java (original)
+++ logging/log4j/trunk/src/java/org/apache/log4j/spi/LoggerRepository.java Sun Jan  1 21:10:42 2006
@@ -1,12 +1,12 @@
 /*
- * Copyright 1999,2004 The Apache Software Foundation.
- * 
+ * Copyright 1999,2005 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.
@@ -16,13 +16,12 @@
 
 package org.apache.log4j.spi;
 
-import org.apache.log4j.*;
-import org.apache.log4j.plugins.PluginRegistry;
-import org.apache.log4j.scheduler.Scheduler;
+import org.apache.log4j.Appender;
+import org.apache.log4j.Category;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
 
 import java.util.Enumeration;
-import java.util.List;
-import java.util.Map;
 
 
 /**
@@ -36,76 +35,34 @@
    can act as a point of registry for events related to loggers.
 
    @author Ceki G&uuml;lc&uuml;
-   @author Mark Womack
    @since 1.2 */
 public interface LoggerRepository {
   /**
-    Add a {@link LoggerRepositoryEventListener} to the repository. The
-    listener will be called when repository events occur.
-    @since 1.3*/
-  public void addLoggerRepositoryEventListener(
-    LoggerRepositoryEventListener listener);
+     Add a {@link HierarchyEventListener} event to the repository.
+     @deprecated Superceded by LoggerRepositoryEx.addLoggerEventListener.
+  */
+  public void addHierarchyEventListener(HierarchyEventListener listener);
 
   /**
-    Remove a {@link LoggerRepositoryEventListener} from the repository.
-    @since 1.3*/
-  public void removeLoggerRepositoryEventListener(
-    LoggerRepositoryEventListener listener);
-
-  /**
-    Add a {@link LoggerEventListener} to the repository. The  listener
-    will be called when repository events occur.
-    @since 1.3*/
-  public void addLoggerEventListener(LoggerEventListener listener);
-
-  
-  /**
-    Remove a {@link LoggerEventListener} from the repository.
-    @since 1.3*/
-  public void removeLoggerEventListener(LoggerEventListener listener);
-
-  /**
-     Is the repository disabled for a given level? The answer depends
-     on the repository threshold and the <code>level</code>
-     parameter. See also {@link #setThreshold} method.  */
+     Returns whether this repository is disabled for a given
+     level. The answer depends on the repository threshold and the
+     <code>level</code> parameter. See also {@link #setThreshold}
+     method.  */
   boolean isDisabled(int level);
 
-
   /**
-   * Get the name of this logger repository.
-   * @since 1.3
-   */
-  public String getName();
-
-  
-  /**
-   * A logger repository is a named entity.
-   * @since 1.3
-   */
-  public void setName(String repoName);
-
-  /**
-   * Set the repository-wide threshold. All logging requests below the threshold
-   * are immediately dropped. By default, the threshold is set to 
-   * <code>Level.ALL</code> which has the lowest possible rank.  
-   * 
-   * <p>The repository-wide threshold acts as a global on off switch. It avoids
-   * the hierarchy walk, hence improving performance. In future log4j versions
-   * the speed of the hiearchy walk will be significantly improved obliviating
-   * the need for this method.
-   * 
-   * <p>The repository-wide threshold is a deprecated feature.
-   * 
-   * */
+     Set the repository-wide threshold. All logging requests below the
+     threshold are immediately dropped. By default, the threshold is
+     set to <code>Level.ALL</code> which has the lowest possible rank.  */
   public void setThreshold(Level level);
-  
+
   /**
       Another form of {@link #setThreshold(Level)} accepting a string
       parameter instead of a <code>Level</code>. */
   public void setThreshold(String val);
 
-  public void emitNoAppenderWarning(Category logger);
-  
+  public void emitNoAppenderWarning(Category cat);
+
   /**
      Get the repository-wide threshold. See {@link
      #setThreshold(Level)} for an explanation. */
@@ -117,21 +74,6 @@
 
   public Logger getRootLogger();
 
-  /**
-   * Is the current configuration of the reposiroty in its original (pristine)
-   * state?
-   * 
-   * @since 1.3
-   */
-  public boolean isPristine();
-  
-  /**
-   *  Set the pristine flag. 
-   *  @see #isPristine 
-   *  @since 1.3
-   */
-  public void setPristine(boolean state);
-  
   public abstract Logger exists(String name);
 
   public abstract void shutdown();
@@ -139,99 +81,11 @@
   public Enumeration getCurrentLoggers();
 
   /**
-     @deprecated Please use {@link #getCurrentLoggers} instead.  */
+     Deprecated. Please use {@link #getCurrentLoggers} instead.  */
   public Enumeration getCurrentCategories();
 
-  public abstract void resetConfiguration();
-
-  /**
-    Requests that a appender added event be sent to any registered
-    {@link LoggerEventListener}.
-    @param logger The logger to which the appender was added.
-    @param appender The appender added to the logger.*/
-  public abstract void fireAddAppenderEvent(Category logger, Appender appender);
-
-  /**
-    Requests that a appender removed event be sent to any registered
-    {@link LoggerEventListener}.
-    @param logger The logger from which the appender was removed.
-    @param appender The appender removed from the logger.
-    @since 1.3*/
-  public abstract void fireRemoveAppenderEvent(
+  public abstract void fireAddAppenderEvent(
     Category logger, Appender appender);
 
-  /**
-    Requests that a level changed event be sent to any registered
-    {@link LoggerEventListener}.
-    @param logger The logger which changed levels.
-    @since 1.3*/
-  public abstract void fireLevelChangedEvent(Logger logger);
-
-  /**
-    Requests that a configuration changed event be sent to any registered
-    {@link LoggerRepositoryEventListener}.
-    @since 1.3*/
-  public abstract void fireConfigurationChangedEvent();
-  
-  /**
-   * Return the PluginRegisty for this LoggerRepository.
-   * @since 1.3
-   */
-  public PluginRegistry getPluginRegistry();
-
-  
-  /**
-   * Return the {@link Scheduler} for this LoggerRepository.
-   * @since 1.3
-   */
-  public Scheduler getScheduler();
-  
-  /** 
-   * Get the properties specific for this repository.
-   * @since 1.3
-   */
-  public Map getProperties();
-
-  /** 
-   * Get the property of this repository.
-   * @since 1.3
-   */
-  public String getProperty(String key);
-
-  /** 
-   * Set a property of this repository.
-   * @since 1.3
-   */
-  public void setProperty(String key, String value);
-  
-  /**
-   * Errors which cannot be logged, go to the error list
-   * 
-   * @return List
-   */
-  public List getErrorList();
-
-  /**
-   * Errors which cannot be logged, go to the error list
-   * 
-   * @param errorItem an ErrorItem to add to the error list
-   */
-  public void addErrorItem(ErrorItem errorItem);
-  
-  /**
-   * A LoggerRepository can also act as a store for various objects used
-   * by log4j components.
-   * 
-   * @return The object stored under 'key'.
-   * @since 1.3
-   */
-  public Object getObject(String key);
- 
-  /**
-   * Store an object under 'key'. If no object can be found, null is returned.
-   * 
-   * @param key
-   * @param value
-   */
-  public void putObject(String key, Object value);
+  public abstract void resetConfiguration();
 }

Added: logging/log4j/trunk/src/java/org/apache/log4j/spi/LoggerRepositoryEx.java
URL: http://svn.apache.org/viewcvs/logging/log4j/trunk/src/java/org/apache/log4j/spi/LoggerRepositoryEx.java?rev=365293&view=auto
==============================================================================
--- logging/log4j/trunk/src/java/org/apache/log4j/spi/LoggerRepositoryEx.java (added)
+++ logging/log4j/trunk/src/java/org/apache/log4j/spi/LoggerRepositoryEx.java Sun Jan  1 21:10:42 2006
@@ -0,0 +1,192 @@
+/*
+ * Copyright 1999,2006 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.log4j.spi;
+
+import org.apache.log4j.Appender;
+import org.apache.log4j.Category;
+import org.apache.log4j.Logger;
+import org.apache.log4j.plugins.PluginRegistry;
+import org.apache.log4j.scheduler.Scheduler;
+
+import java.util.List;
+import java.util.Map;
+
+
+/**
+   A <code>LoggerRepository</code> is used to create and retrieve
+   <code>Loggers</code>. The relation between loggers in a repository
+   depends on the repository but typically loggers are arranged in a
+   named hierarchy.
+
+   <p>In addition to the creational methods, a
+   <code>LoggerRepository</code> can be queried for existing loggers,
+   can act as a point of registry for events related to loggers.
+
+   @author Ceki G&uuml;lc&uuml;
+   @author Mark Womack
+   @author Curt Arnold
+   @since 1.3 */
+public interface LoggerRepositoryEx extends LoggerRepository {
+  /**
+    Add a {@link LoggerRepositoryEventListener} to the repository. The
+    listener will be called when repository events occur.
+     @param listener event listener, may not be null.
+    @since 1.3*/
+  void addLoggerRepositoryEventListener(
+    LoggerRepositoryEventListener listener);
+
+  /**
+    Remove a {@link LoggerRepositoryEventListener} from the repository.
+   @param listener listener.
+    @since 1.3*/
+  void removeLoggerRepositoryEventListener(
+    LoggerRepositoryEventListener listener);
+
+  /**
+    Add a {@link LoggerEventListener} to the repository. The  listener
+    will be called when repository events occur.
+   @param listener listener, may not be null.
+    @since 1.3*/
+  void addLoggerEventListener(LoggerEventListener listener);
+
+  /**
+    Remove a {@link LoggerEventListener} from the repository.
+   @param listener listener, may not be null.
+    @since 1.3*/
+  void removeLoggerEventListener(LoggerEventListener listener);
+
+  /**
+   * Get the name of this logger repository.
+   * @return name, may not be null.
+   * @since 1.3
+   */
+  String getName();
+
+  /**
+   * A logger repository is a named entity.
+   * @param repoName new name, may not be null.
+   * @since 1.3
+   */
+  void setName(String repoName);
+
+  /**
+   * Is the current configuration of the repository in its original (pristine)
+   * state?
+   * @return true if repository is in original state.
+   *
+   * @since 1.3
+   */
+  boolean isPristine();
+
+  /**
+   *  Set the pristine flag.
+   * @param state state
+   *  @see #isPristine
+   *  @since 1.3
+   */
+  void setPristine(boolean state);
+
+  /**
+    Requests that a appender removed event be sent to any registered
+    {@link LoggerEventListener}.
+    @param logger The logger from which the appender was removed.
+    @param appender The appender removed from the logger.
+    @since 1.3*/
+  void fireRemoveAppenderEvent(Category logger, Appender appender);
+
+  /**
+    Requests that a level changed event be sent to any registered
+    {@link LoggerEventListener}.
+    @param logger The logger which changed levels.
+    @since 1.3*/
+  void fireLevelChangedEvent(Logger logger);
+
+  /**
+    Requests that a configuration changed event be sent to any registered
+    {@link LoggerRepositoryEventListener}.
+    @since 1.3*/
+  void fireConfigurationChangedEvent();
+
+  /**
+   * Return the PluginRegisty for this LoggerRepository.
+   * @return plug in registry.
+   * @since 1.3
+   */
+  PluginRegistry getPluginRegistry();
+
+  /**
+   * Return the {@link Scheduler} for this LoggerRepository.
+   * @return scheduler.
+   * @since 1.3
+   */
+  Scheduler getScheduler();
+
+  /**
+   * Get the properties specific for this repository.
+   * @return property map.
+   * @since 1.3
+   */
+  Map getProperties();
+
+  /**
+   * Get the property of this repository.
+   * @param key property key.
+   * @return key value or null if not set.
+   * @since 1.3
+   */
+  String getProperty(String key);
+
+  /**
+   * Set a property of this repository.
+   * @param key key, may not be null.
+   * @param value new value, if null, property will be removed.
+   * @since 1.3
+   */
+  void setProperty(String key, String value);
+
+  /**
+   * Errors which cannot be logged, go to the error list
+   *
+   * @return List
+   */
+  List getErrorList();
+
+  /**
+   * Errors which cannot be logged, go to the error list
+   *
+   * @param errorItem an ErrorItem to add to the error list
+   */
+  void addErrorItem(ErrorItem errorItem);
+
+  /**
+   * A LoggerRepository can also act as a store for various objects used
+   * by log4j components.
+   *
+   * @param key key, may not be null.
+   * @return The object stored under 'key'.
+   * @since 1.3
+   */
+  Object getObject(String key);
+
+  /**
+   * Store an object under 'key'. If no object can be found, null is returned.
+   *
+   * @param key key, may not be null.
+   * @param value value, may be null.
+   */
+  void putObject(String key, Object value);
+}

Modified: logging/log4j/trunk/src/java/org/apache/log4j/spi/LoggingEvent.java
URL: http://svn.apache.org/viewcvs/logging/log4j/trunk/src/java/org/apache/log4j/spi/LoggingEvent.java?rev=365293&r1=365292&r2=365293&view=diff
==============================================================================
--- logging/log4j/trunk/src/java/org/apache/log4j/spi/LoggingEvent.java (original)
+++ logging/log4j/trunk/src/java/org/apache/log4j/spi/LoggingEvent.java Sun Jan  1 21:10:42 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999,2004 The Apache Software Foundation.
+ * Copyright 1999,2006 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.
@@ -549,7 +549,10 @@
       }
 
       if (logger != null) {
-        properties.putAll(logger.getLoggerRepository().getProperties());
+        LoggerRepository repo = logger.getLoggerRepository();
+        if (repo instanceof LoggerRepositoryEx) {
+            properties.putAll(((LoggerRepositoryEx) repo).getProperties());
+        }
       }
     }
   }
@@ -583,7 +586,10 @@
 
     // if still not found try, the properties in the logger repository
     if (logger != null) {
-      value = logger.getLoggerRepository().getProperty(key);
+      LoggerRepository repo = logger.getLoggerRepository();
+      if (repo instanceof LoggerRepositoryEx) {
+        value = ((LoggerRepositoryEx) repo).getProperty(key);
+      }
     }
 
     return value;

Modified: logging/log4j/trunk/src/java/org/apache/log4j/spi/RootCategory.java
URL: http://svn.apache.org/viewcvs/logging/log4j/trunk/src/java/org/apache/log4j/spi/RootCategory.java?rev=365293&r1=365292&r2=365293&view=diff
==============================================================================
--- logging/log4j/trunk/src/java/org/apache/log4j/spi/RootCategory.java (original)
+++ logging/log4j/trunk/src/java/org/apache/log4j/spi/RootCategory.java Sun Jan  1 21:10:42 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999,2004 The Apache Software Foundation.
+ * Copyright 1999,2006 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.
@@ -16,7 +16,8 @@
 
 package org.apache.log4j.spi;
 
-import org.apache.log4j.*;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
 
 // Contibutors: Mathias Bogaert
 
@@ -51,8 +52,8 @@
      @since 0.8.3 */
   public final void setLevel(Level level) {
     if (level == null) {
-      if (repository != null) {
-        repository.addErrorItem(
+      if (repository instanceof LoggerRepositoryEx) {
+        ((LoggerRepositoryEx) repository).addErrorItem(
           new ErrorItem(
             "You have tried to set a null level to root.", new Exception()));
       }

Modified: logging/log4j/trunk/src/java/org/apache/log4j/spi/RootLogger.java
URL: http://svn.apache.org/viewcvs/logging/log4j/trunk/src/java/org/apache/log4j/spi/RootLogger.java?rev=365293&r1=365292&r2=365293&view=diff
==============================================================================
--- logging/log4j/trunk/src/java/org/apache/log4j/spi/RootLogger.java (original)
+++ logging/log4j/trunk/src/java/org/apache/log4j/spi/RootLogger.java Sun Jan  1 21:10:42 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999,2004 The Apache Software Foundation.
+ * Copyright 1999,2006 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.
@@ -16,7 +16,8 @@
 
 package org.apache.log4j.spi;
 
-import org.apache.log4j.*;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
 
 
 // Contibutors: Mathias Bogaert
@@ -58,8 +59,8 @@
      @since 0.8.3 */
   public final void setLevel(Level level) {
     if (level == null) {
-      if (repository != null) {
-        repository.addErrorItem(
+      if (repository instanceof LoggerRepositoryEx) {
+        ((LoggerRepositoryEx) repository).addErrorItem(
           new ErrorItem(
             "You have tried to set a null level to root.", new Exception()));
       }

Modified: logging/log4j/trunk/src/java/org/apache/log4j/watchdog/TimedURLWatchdog.java
URL: http://svn.apache.org/viewcvs/logging/log4j/trunk/src/java/org/apache/log4j/watchdog/TimedURLWatchdog.java?rev=365293&r1=365292&r2=365293&view=diff
==============================================================================
--- logging/log4j/trunk/src/java/org/apache/log4j/watchdog/TimedURLWatchdog.java (original)
+++ logging/log4j/trunk/src/java/org/apache/log4j/watchdog/TimedURLWatchdog.java Sun Jan  1 21:10:42 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999,2004 The Apache Software Foundation.
+ * Copyright 1999,2006 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.
@@ -19,7 +19,8 @@
 import java.net.URL;
 
 import org.apache.log4j.scheduler.Job;
-import org.apache.log4j.watchdog.WatchdogSkeleton;
+import org.apache.log4j.spi.LoggerRepository;
+import org.apache.log4j.spi.LoggerRepositoryEx;
 
 /**
   Implements functionality of a watchdog that periodically checks a URL for
@@ -133,10 +134,15 @@
     
     // get the current modification time of the watched source
     lastModTime = getModificationTime();
-    
-    // schedule this Wathdog as a Job with the Scheduler
-    getLoggerRepository().getScheduler().schedule(this,
+
+    LoggerRepository repo = getLoggerRepository();
+    if (repo instanceof LoggerRepositoryEx) {
+        ((LoggerRepositoryEx) repo).getScheduler().schedule(this,
       System.currentTimeMillis() + interval, interval);
+    } else {
+        this.getLogger().error("{} watchdog requires repository that supports LoggerRepositoryEx",
+          this.getName());
+    }
   }
   
   /**
@@ -144,6 +150,9 @@
    * simply removes the watchdog from the Scheduler.
    */
   public void shutdown() {
-    getLoggerRepository().getScheduler().delete(this);
+    LoggerRepository repo = getLoggerRepository();
+    if (repo instanceof LoggerRepositoryEx) {
+        ((LoggerRepositoryEx) repo).getScheduler().delete(this);
+    }
   }
 }

Modified: logging/log4j/trunk/tests/src/java/org/apache/log4j/db/FullCycleDBTest.java
URL: http://svn.apache.org/viewcvs/logging/log4j/trunk/tests/src/java/org/apache/log4j/db/FullCycleDBTest.java?rev=365293&r1=365292&r2=365293&view=diff
==============================================================================
--- logging/log4j/trunk/tests/src/java/org/apache/log4j/db/FullCycleDBTest.java (original)
+++ logging/log4j/trunk/tests/src/java/org/apache/log4j/db/FullCycleDBTest.java Sun Jan  1 21:10:42 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999,2004 The Apache Software Foundation.
+ * Copyright 1999,2006 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.
@@ -52,8 +52,8 @@
        extends TestCase {
   
   Vector witnessEvents;
-  LoggerRepository lrWrite;
-  LoggerRepository lrRead;
+  Hierarchy lrWrite;
+  Hierarchy lrRead;
   String appendConfigFile = null;
   String readConfigFile = null;
   

Modified: logging/log4j/trunk/tests/src/java/org/apache/log4j/joran/InterpreterTest.java
URL: http://svn.apache.org/viewcvs/logging/log4j/trunk/tests/src/java/org/apache/log4j/joran/InterpreterTest.java?rev=365293&r1=365292&r2=365293&view=diff
==============================================================================
--- logging/log4j/trunk/tests/src/java/org/apache/log4j/joran/InterpreterTest.java (original)
+++ logging/log4j/trunk/tests/src/java/org/apache/log4j/joran/InterpreterTest.java Sun Jan  1 21:10:42 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999,2004 The Apache Software Foundation.
+ * Copyright 1999,2006 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.
@@ -56,6 +56,7 @@
 import org.apache.log4j.rolling.FixedWindowRollingPolicy;
 import org.apache.log4j.spi.ErrorItem;
 import org.apache.log4j.spi.LoggerRepository;
+import org.apache.log4j.spi.LoggerRepositoryEx;
 import org.xml.sax.SAXParseException;
 
 import java.util.HashMap;
@@ -358,7 +359,7 @@
     Appender appender = (Appender) appenderBag.get("A1");
     PatternLayout pl = (PatternLayout) appender.getLayout();
     
-    Map ruleRegistry = (Map) repository.getObject(PatternLayout.PATTERN_RULE_REGISTRY);
+    Map ruleRegistry = (Map) ((LoggerRepositoryEx) repository).getObject(PatternLayout.PATTERN_RULE_REGISTRY);
     assertEquals("org.apache.log4j.toto", ruleRegistry.get("toto"));
   }
   

Modified: logging/log4j/trunk/tests/src/java/org/apache/log4j/plugins/PluginTestCase.java
URL: http://svn.apache.org/viewcvs/logging/log4j/trunk/tests/src/java/org/apache/log4j/plugins/PluginTestCase.java?rev=365293&r1=365292&r2=365293&view=diff
==============================================================================
--- logging/log4j/trunk/tests/src/java/org/apache/log4j/plugins/PluginTestCase.java (original)
+++ logging/log4j/trunk/tests/src/java/org/apache/log4j/plugins/PluginTestCase.java Sun Jan  1 21:10:42 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999,2004 The Apache Software Foundation.
+ * Copyright 1999,2006 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.
@@ -27,6 +27,7 @@
 import org.apache.log4j.Logger;
 import org.apache.log4j.SimpleLayout;
 import org.apache.log4j.spi.LoggerRepository;
+import org.apache.log4j.spi.LoggerRepositoryEx;
 import org.apache.log4j.spi.RootLogger;
 import org.apache.log4j.util.Compare;
 
@@ -52,7 +53,7 @@
     }
 
     public void setUp() {
-        pluginRegistry = LogManager.getLoggerRepository().getPluginRegistry(); 
+        pluginRegistry = ((LoggerRepositoryEx) LogManager.getLoggerRepository()).getPluginRegistry();
         
         // delete the output file if they happen to exist
         File file = new File(getOutputFile("test1"));

Modified: logging/log4j/trunk/tests/src/java/org/apache/log4j/watchdog/FileWatchdogTestCase.java
URL: http://svn.apache.org/viewcvs/logging/log4j/trunk/tests/src/java/org/apache/log4j/watchdog/FileWatchdogTestCase.java?rev=365293&r1=365292&r2=365293&view=diff
==============================================================================
--- logging/log4j/trunk/tests/src/java/org/apache/log4j/watchdog/FileWatchdogTestCase.java (original)
+++ logging/log4j/trunk/tests/src/java/org/apache/log4j/watchdog/FileWatchdogTestCase.java Sun Jan  1 21:10:42 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999,2004 The Apache Software Foundation.
+ * Copyright 1999,2006 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.
@@ -29,6 +29,7 @@
 import org.apache.log4j.Logger;
 import org.apache.log4j.PropertyConfigurator;
 import org.apache.log4j.spi.Configurator;
+import org.apache.log4j.spi.LoggerRepositoryEx;
 import org.apache.log4j.joran.JoranConfigurator;
 
 
@@ -139,7 +140,7 @@
       watchdog.setURL(configURL);
       watchdog.setInterval(2000);
       watchdog.setConfigurator(JoranConfigurator.class.getName());
-      LogManager.getLoggerRepository().getPluginRegistry().addPlugin(watchdog);
+      ((LoggerRepositoryEx) LogManager.getLoggerRepository()).getPluginRegistry().addPlugin(watchdog);
       watchdog.activateOptions();
 
       // output some test messages
@@ -194,7 +195,7 @@
       watchdog.setURL(configURL);
       watchdog.setInterval(2000);
       watchdog.setConfigurator(PropertyConfigurator.class.getName());
-      LogManager.getLoggerRepository().getPluginRegistry().addPlugin(watchdog);
+      ((LoggerRepositoryEx) LogManager.getLoggerRepository()).getPluginRegistry().addPlugin(watchdog);
       watchdog.activateOptions();
 
       // output some test messages



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