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/joran/action Action.java
Date Wed, 31 Mar 2004 19:34:16 GMT
ceki        2004/03/31 11:34:16

  Modified:    tests/input/joran parser3.xml
               tests/src/java/org/apache/joran InterpreterTest.java
               src/java/org/apache/log4j/joran/action LevelAction.java
               tests/src/java/org/apache/joran/action HelloAction.java
               src/java/org/apache/joran/action Action.java
  Log:
  
  Removed the finish method from Action interface as I don't see a use for it.
  
  Revision  Changes    Path
  1.2       +9 -19     logging-log4j/tests/input/joran/parser3.xml
  
  Index: parser3.xml
  ===================================================================
  RCS file: /home/cvs/logging-log4j/tests/input/joran/parser3.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- parser3.xml	12 Sep 2003 18:24:26 -0000	1.1
  +++ parser3.xml	31 Mar 2004 19:34:15 -0000	1.2
  @@ -1,40 +1,30 @@
   <?xml version="1.0" encoding="UTF-8" ?>
   <!DOCTYPE log4j:configuration>
   
  -<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
  -  1
  +<log4j:configuration>
  +
     <appender name="A1" class="org.apache.log4j.rolling.RollingFileAppender">
       <param name="File"   value="output/temp.A1" />
       <param name="Append" value="false" />	    
  -2
  +
       <rollingPolicy class="org.apache.log4j.rolling.SlidingWindowRollingPolicy">
          <param name="activeFileName" value="output/parser3"/>
         <param name="fileNamePattern" value="output/parser3.%i"/>
       </rollingPolicy>
  -3    
  +
       <triggeringPolicy class="org.apache.log4j.rolling.SizeBasedTriggeringPolicy">
         <param name="maxFileSize" value="100"/>
       </triggeringPolicy>
  -4        
  +
       <layout class="org.apache.log4j.PatternLayout">
         <param name="ConversionPattern" value="%-5p %c{2} - %m%n"/>
       </layout>	    
     </appender>
  -5  
  -6  
  -  <logger>
  -    <level value ="debug" />
  -    <appender-ref ref="A1" />
  -  </logger>
  - 7 
  -   <logger name="asd">
  -    <level value ="debug" />
  -    <appender-ref ref="A1" />
  -  </logger>
  -8    
  +
  +
     <root>
  -    <level value ="debug" />
  +    <level value ="WARN" />
       <appender-ref ref="A1" />
     </root>
  -9  
  +
   </log4j:configuration>
  
  
  
  1.2       +24 -3     logging-log4j/tests/src/java/org/apache/joran/InterpreterTest.java
  
  Index: InterpreterTest.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/tests/src/java/org/apache/joran/InterpreterTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- InterpreterTest.java	31 Mar 2004 19:02:14 -0000	1.1
  +++ InterpreterTest.java	31 Mar 2004 19:34:16 -0000	1.2
  @@ -46,6 +46,9 @@
   import org.apache.log4j.joran.action.LevelAction;
   import org.apache.log4j.joran.action.LoggerAction;
   import org.apache.log4j.joran.action.RootLoggerAction;
  +import org.apache.log4j.rolling.RollingFileAppender;
  +import org.apache.log4j.rolling.SizeBasedTriggeringPolicy;
  +import org.apache.log4j.rolling.SlidingWindowRollingPolicy;
   
   import java.util.HashMap;
   import java.util.Stack;
  @@ -247,9 +250,8 @@
         new Pattern("log4j:configuration/logger/level"), new LevelAction());
       rs.addRule(
         new Pattern("log4j:configuration/root"), new RootLoggerAction());
  -
  -    //rs.addRule(
  -    //new Pattern("log4j:configuration/root/level"), new LevelAction());
  +    rs.addRule(
  +      new Pattern("log4j:configuration/root/level"), new LevelAction());
       rs.addRule(
         new Pattern("log4j:configuration/logger/appender-ref"),
         new AppenderRefAction());
  @@ -275,6 +277,22 @@
       saxParser.parse("file:input/joran/parser3.xml", jp);
   
       // the following assertions depend on the contensts of parser3.xml
  +    Logger rootLogger = LogManager.getLoggerRepository().getRootLogger();
  +    assertSame(Level.WARN, rootLogger.getLevel());
  + 
  +    RollingFileAppender a1Back = (RollingFileAppender) rootLogger.getAppender("A1");  
  +    assertFalse("a1.append should be false", a1Back.getAppend());
  +    PatternLayout plBack = (PatternLayout) a1Back.getLayout();
  +    assertEquals("%-5p %c{2} - %m%n", plBack.getConversionPattern());
  +         
  +    SlidingWindowRollingPolicy swrp = (SlidingWindowRollingPolicy) a1Back.getRollingPolicy();
  +    assertEquals("output/parser3", swrp.getActiveFileName());
  +    assertEquals("output/parser3.%i", swrp.getFileNamePattern());
  +    
  +    SizeBasedTriggeringPolicy sbtp = (SizeBasedTriggeringPolicy) a1Back.getTriggeringPolicy();
  +    assertEquals(100, sbtp.getMaxFileSize());
  +    
  +    //System.out.println(ec.getErrorList());
     }
   
     public void testNewConversionWord() throws Exception {
  @@ -308,6 +326,9 @@
       PatternLayout pl = (PatternLayout) appender.getLayout();
       assertEquals("org.apache.log4j.toto", pl.getRuleRegistry().get("toto"));
     }
  +  
  +  
  +  
     
     public void testNewRule1() throws Exception {
       logger.debug("Starting testNewConversionWord");
  
  
  
  1.5       +3 -3      logging-log4j/src/java/org/apache/log4j/joran/action/LevelAction.java
  
  Index: LevelAction.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/joran/action/LevelAction.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- LevelAction.java	31 Mar 2004 13:13:15 -0000	1.4
  +++ LevelAction.java	31 Mar 2004 19:34:16 -0000	1.5
  @@ -71,10 +71,10 @@
       logger.debug(loggerName + " level set to " + l.getLevel());
   
     }
  -
  -  public void end(ExecutionContext ec, String e) {
  +  
  +  public  void finish(ExecutionContext ec) {
     }
   
  -  public void finish(ExecutionContext ec) {
  +  public void end(ExecutionContext ec, String e) {
     }
   }
  
  
  
  1.6       +0 -3      logging-log4j/tests/src/java/org/apache/joran/action/HelloAction.java
  
  Index: HelloAction.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/tests/src/java/org/apache/joran/action/HelloAction.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- HelloAction.java	31 Mar 2004 13:13:15 -0000	1.5
  +++ HelloAction.java	31 Mar 2004 19:34:16 -0000	1.6
  @@ -45,7 +45,4 @@
      */
     public void end(ExecutionContext ec, String name) {
     }
  -
  -  public void finish(ExecutionContext ec) {
  -  }
   }
  
  
  
  1.10      +1 -1      logging-log4j/src/java/org/apache/joran/action/Action.java
  
  Index: Action.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/joran/action/Action.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- Action.java	31 Mar 2004 19:02:14 -0000	1.9
  +++ Action.java	31 Mar 2004 19:34:16 -0000	1.10
  @@ -59,7 +59,7 @@
   
     public abstract void end(ExecutionContext ec, String name);
   
  -  public abstract void finish(ExecutionContext ec);
  +  //public abstract void finish(ExecutionContext ec);
   
     public String toString() {
       return this.getClass().getName();
  
  
  

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