ceki        2005/01/08 05:13:46

  Modified:    .        ugli.xml build.xml
               src/java/org/apache/joran/action NestComponentIA.java
               src/java/org/apache/ugli/impl Log4jLoggerFA.java
               src/java/org/apache/log4j/helpers OptionConverter.java
               src/java/org/apache/log4j LogManager.java
               tests    ugli-test.xml
  Log:
  - log4j.jar now confoms to the UGLI model.
  - Minor changes.
  
  The problem discovered by Scott is still not fixed.
  
  Revision  Changes    Path
  1.5       +6 -6      logging-log4j/ugli.xml
  
  Index: ugli.xml
  ===================================================================
  RCS file: /home/cvs/logging-log4j/ugli.xml,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ugli.xml  3 Jan 2005 11:05:45 -0000       1.4
  +++ ugli.xml  8 Jan 2005 13:13:46 -0000       1.5
  @@ -15,9 +15,9 @@
     
     <property name="UGLI_STEM" value="org/apache/ugli"/>
     
  -  <property name="ugli.properties" value="./classes/ugli.properties"/>
  +  <property name="path2ugli.properties" value="./classes/ugli.properties"/>
   
  -    <!-- ================================================================= 
-->
  +  <!-- ================================================================= -->
     <!-- Default target                                                    -->
     <!-- ================================================================= -->
     <target name="usage">
  @@ -39,7 +39,7 @@
     <!-- ================================================================= -->
     <target name="clean" description="Delete all compiled UGLI files.">
       <delete dir="${javac.dest}/org/apache/ugli" />
  -    <delete file="${ugli.properties}"/>
  +    <delete file="${path2ugli.properties}"/>
     </target>
   
   
  @@ -84,10 +84,10 @@
          as specified by the "jar-name" and "impl" parameters. -->
     <target name="ugli-IMPL.jar" depends="build.core">
       
  -    <delete file="${ugli.properties}"/>
  +    <delete file="${path2ugli.properties}"/>
   
       <!-- Much depends on setting up ugli.properties file correctly -->
  -    <propertyfile file="${ugli.properties}" comment="${impl} Logger 
implementation">
  +    <propertyfile file="${path2ugli.properties}" comment="${impl} Logger 
implementation">
         <entry key="ugli.factoryAdapterClass" 
value="org.apache.ugli.impl.${impl}LoggerFA"/>
       </propertyfile>
   
  @@ -110,7 +110,7 @@
       </jar>
       
       <!-- remove ugli.properties when done -->
  -    <delete file="${ugli.properties}"/>
  +    <delete file="${path2ugli.properties}"/>
     </target>
   
     <target name="ugli-nop.jar" depends="build.core">
  
  
  
  1.134     +15 -2     logging-log4j/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/logging-log4j/build.xml,v
  retrieving revision 1.133
  retrieving revision 1.134
  diff -u -r1.133 -r1.134
  --- build.xml 6 Jan 2005 21:54:23 -0000       1.133
  +++ build.xml 8 Jan 2005 13:13:46 -0000       1.134
  @@ -66,6 +66,8 @@
     <!-- Directory for temporary files. -->
     <property name="dist.tmp" value="dist/tmp"/>
   
  +  <!-- Note that this property is duplicated in ugli.xml -->
  +  <property name="path2ugli.properties" value="./classes/ugli.properties"/>
   
     <!-- Construct compile classpath -->
     <path id="compile.classpath">
  @@ -359,7 +361,7 @@
     <!-- ================================================================= -->
     <!-- Aactual work is done in the dependencies.                         -->
     <!-- ================================================================= -->
  -  <target name="jar" depends="log4j.jar">
  +  <target name="jar" depends="log4j.jar, chainsaw.jar">
     </target>
   
     <!-- ================================================================= -->
  @@ -368,9 +370,16 @@
     <target name="log4j.jar" depends="build">
       
       <delete file="${log4j.jar}" verbose="true"/>
  +    <delete file="${path2ugli.properties}"/>
  +
  +    <!-- Much depends on setting up ugli.properties file correctly -->
  +    <propertyfile file="${path2ugli.properties}" comment="log4j 
implementation">
  +      <entry key="ugli.factoryAdapterClass" 
value="org.apache.ugli.impl.Log4jLoggerFA"/>
  +    </propertyfile>
   
       <jar jarfile="${jar.dest}/${log4j.jar}" basedir="${javac.dest}"
  -         includes="org/apache/ugli/**/*.class
  +         includes="ugli.properties,
  +                org/apache/ugli/**/*.class
                   ${stem}/*.class, 
                ${stem}/xml/log4j.dtd, 
                ${stem}/xml/logger.dtd,
  @@ -410,6 +419,10 @@
           </section>
         </manifest>
       </jar>
  +
  +    <!-- remove ugli.properties when done -->
  +    <delete file="${path2ugli.properties}"/>
  +
     </target>
     
     
  
  
  
  1.19      +1 -1      
logging-log4j/src/java/org/apache/joran/action/NestComponentIA.java
  
  Index: NestComponentIA.java
  ===================================================================
  RCS file: 
/home/cvs/logging-log4j/src/java/org/apache/joran/action/NestComponentIA.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- NestComponentIA.java      6 Jan 2005 23:15:53 -0000       1.18
  +++ NestComponentIA.java      8 Jan 2005 13:13:46 -0000       1.19
  @@ -42,7 +42,7 @@
     // elements which are handled by the same NestComponentIA instance.
     // We push a ActionData instance in the isApplicable method (if the
     // action is applicable) and pop it in the end() method.
  -  // The XML well-formedness rule will guarantee that a push will eventually
  +  // The XML well-formedness property will guarantee that a push will 
eventually
     // be followed by the corresponding pop.
     Stack actionDataStack = new Stack();
   
  
  
  
  1.2       +17 -7     
logging-log4j/src/java/org/apache/ugli/impl/Log4jLoggerFA.java
  
  Index: Log4jLoggerFA.java
  ===================================================================
  RCS file: 
/home/cvs/logging-log4j/src/java/org/apache/ugli/impl/Log4jLoggerFA.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Log4jLoggerFA.java        3 Jan 2005 11:05:45 -0000       1.1
  +++ Log4jLoggerFA.java        8 Jan 2005 13:13:46 -0000       1.2
  @@ -21,25 +21,35 @@
   import org.apache.ugli.ULogger;
   
   /**
  - * @author ceki
  + * This factory adapter relies on log4's [EMAIL PROTECTED] LogManager} to do 
its job.
  + * 
  + * @author Ceki G&uuml;lc&uuml;
    *
  - * To change the template for this generated type comment go to
  - * Window>Preferences>Java>Code Generation>Code and Comments
    */
   public class Log4jLoggerFA implements LoggerFactoryAdapter {
   
     public Log4jLoggerFA() {
     }
   
  -  /* (non-Javadoc)
  -   * @see org.apache.ugli.LoggerFactoryAdapter#getLogger(java.lang.String)
  +  /**
  +   * Get a [EMAIL PROTECTED] ULogger} by name, by delegating all work to 
log4's 
  +   * [EMAIL PROTECTED] LogManager}.
  +   * 
  +   * <p>The implementation is trivial because log4j 
  +   * [EMAIL PROTECTED] org.apache.log4j.Logger loggers} directly implement 
the 
  +   * [EMAIL PROTECTED] ULogger} interface.
      */
     public ULogger getLogger(String name) {
       return LogManager.getLogger(name);  
     }
   
  -  /* (non-Javadoc)
  -   * @see org.apache.ugli.LoggerFactoryAdapter#getLogger(java.lang.String, 
java.lang.String)
  +  /**
  +   * Get a [EMAIL PROTECTED] ULogger} by domain and subdomain name, by 
delegating all work 
  +   * to log4's [EMAIL PROTECTED] LogManager}.
  +   * 
  +   * <p>The implementation is trivial because log4j 
  +   * [EMAIL PROTECTED] org.apache.log4j.Logger loggers} directly implement 
the 
  +   * [EMAIL PROTECTED] ULogger} interface.
      */
     public ULogger getLogger(String domainName, String subDomainName) {
       return LogManager.getLogger(domainName);  
  
  
  
  1.48      +13 -3     
logging-log4j/src/java/org/apache/log4j/helpers/OptionConverter.java
  
  Index: OptionConverter.java
  ===================================================================
  RCS file: 
/home/cvs/logging-log4j/src/java/org/apache/log4j/helpers/OptionConverter.java,v
  retrieving revision 1.47
  retrieving revision 1.48
  diff -u -r1.47 -r1.48
  --- OptionConverter.java      4 Jan 2005 19:42:10 -0000       1.47
  +++ OptionConverter.java      8 Jan 2005 13:13:46 -0000       1.48
  @@ -17,6 +17,7 @@
   package org.apache.log4j.helpers;
   
   import org.apache.log4j.Level;
  +import org.apache.log4j.LogManager;
   import org.apache.log4j.Logger;
   import org.apache.log4j.PropertyConfigurator;
   import org.apache.log4j.spi.ComponentBase;
  @@ -44,7 +45,7 @@
    * @author Anders Kristensen
    * @author Avy Sharell
   */
  -public class OptionConverter extends ComponentBase {
  +public class OptionConverter  {
     static String DELIM_START = "${";
     static char DELIM_STOP = '}';
     static int DELIM_START_LEN = 2;
  @@ -54,9 +55,18 @@
     }
     
     public OptionConverter(LoggerRepository repository) {
  -    this.repository = repository;
  +    //this.repository = repository;
     }
     
  +  // TODO: this method should be removed if OptionConverter becomes a static
  +  static Logger getLogger() {
  +    return LogManager.getLogger(OptionConverter.class);
  +  }
  +
  +  // TODO: this method should be removed if OptionConverter becomes a static
  +  public static void setLoggerRepository(LoggerRepository lr) {
  +  }
  +
     
     public static String[] concatanateArrays(String[] l, String[] r) {
       int len = l.length + r.length;
  @@ -328,7 +338,7 @@
        @param superClass The class to which the new object should belong.
        @param defaultValue The object to return in case of non-fulfillment
      */
  -  public Object instantiateByClassName(
  +  public static Object instantiateByClassName(
       String className, Class superClass, Object defaultValue) {
       if (className != null) {
         try {
  
  
  
  1.36      +1 -15     logging-log4j/src/java/org/apache/log4j/LogManager.java
  
  Index: LogManager.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/LogManager.java,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- LogManager.java   7 Jan 2005 21:32:21 -0000       1.35
  +++ LogManager.java   8 Jan 2005 13:13:46 -0000       1.36
  @@ -235,19 +235,5 @@
     public static void resetConfiguration() {
       repositorySelector.getLoggerRepository().resetConfiguration();
     }
  -  
  -  /**
  -   * 
  -   * Return a singleton [EMAIL PROTECTED] Scheduler} instance to be shared 
by multiple
  -   * receivers and watchdogs. 
  -   * 
  -   * @since 1.3
  -   */
  -//  public static Scheduler getSchedulerInstance() {
  -//    if(schedulerInstance == null) {
  -//      schedulerInstance = new Scheduler();
  -//      schedulerInstance.start();
  -//    }
  -//    return schedulerInstance;
  -//  }
  +
   }
  
  
  
  1.3       +27 -1     logging-log4j/tests/ugli-test.xml
  
  Index: ugli-test.xml
  ===================================================================
  RCS file: /home/cvs/logging-log4j/tests/ugli-test.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ugli-test.xml     3 Jan 2005 10:17:45 -0000       1.2
  +++ ugli-test.xml     8 Jan 2005 13:13:46 -0000       1.3
  @@ -39,6 +39,13 @@
       <pathelement location="../ugli-jdk14.jar"/>
     </path>
   
  +   <path id="log4j.classpath">
  +     <path refid="basic.classpath"/>
  +     <fileset dir="..">
  +       <include name="log4j-*.jar"/>
  +     </fileset>
  +  </path>
  +
   
   
     <!-- ================================================================= -->
  @@ -87,9 +94,13 @@
     </target>
   
     <target name="ugli-jdk14.jar">
  -    <!-- Invoke ugli.xml located one directory up -->
       <ant  dir=".." antfile="ugli.xml" target="ugli-jdk14.jar"/> 
     </target>
  +
  +  <target name="log4j.jar">
  +    <!-- The main build is big enough to have its own properties -->
  +    <ant  dir=".." antfile="build.xml" target="log4j.jar" 
inheritAll="false"/> 
  +  </target>
     
     <!-- ================================================================= -->
     <!-- Run all tests                                                     -->
  @@ -137,6 +148,21 @@
         <formatter type="plain" usefile="false"/>
         <test name="org.apache.ugli.InvokingUGLI" />
       </junit>
  +  </target>
  +
  +
  +  <target name="InvokeLog4j" depends="build, log4j.jar, cleanOutputDir">
  +    
  +    <copy file="input/ugli/basic.xml" tofile="${javac.dest}/log4j.xml"/>
  +
  +    <junit printsummary="yes" fork="yes" haltonfailure="yes">
  +      <classpath refid="log4j.classpath"/>
  +      <formatter type="plain" usefile="false"/>
  +      <test name="org.apache.ugli.InvokingUGLI" />
  +    </junit>
  +
  +    <delete file="${javac.dest}/log4j.xml"/>
  +
     </target>
   
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to