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/tests/src/java/org/apache/log4j RollingFileAppenderTest.java DailyRollingFileAppenderTest.java
Date Tue, 07 Sep 2004 14:54:53 GMT
ceki        2004/09/07 07:54:53

  Added:       tests/src/java/org/apache/log4j RollingFileAppenderTest.java
                        DailyRollingFileAppenderTest.java
  Log:
  Two new tests (manual tests)
  
  Revision  Changes    Path
  1.1                  logging-log4j/tests/src/java/org/apache/log4j/RollingFileAppenderTest.java
  
  Index: RollingFileAppenderTest.java
  ===================================================================
  /*
   * Created on May 28, 2004
   *
   * To change the template for this generated file go to
   * Window>Preferences>Java>Code Generation>Code and Comments
   */
  package org.apache.log4j;
  
  import org.apache.log4j.helpers.LogLog;
  
  import junit.framework.TestCase;
  
  /**
   * 
   * Test the original RollingFileAppender
   * 
   * @author Ceki Gulcu
   */
  public class RollingFileAppenderTest extends TestCase {
   
    protected void setUp() throws Exception {
      super.setUp();
    }
    
    protected void tearDown() throws Exception {
      super.tearDown();
    }
   
    public RollingFileAppenderTest(String arg0) {
      super(arg0);
    }
    
    public void testWriteFooter() {
      LogLog.setInternalDebugging(true);
      RollingFileAppender rfa = new RollingFileAppender();
      PatternLayout patternLayout = new PatternLayout("%m%n");
      patternLayout.setHeader("BEGIN\r\n");
      patternLayout.setFooter("END\r\n");
      rfa.setFile("output/test");
      rfa.setMaximumFileSize(9);
      rfa.setMaxBackupIndex(10);
      rfa.setLayout(patternLayout);
      rfa.activateOptions();
      Logger root = Logger.getRootLogger();
      root.addAppender(rfa);
      
      for(int i = 0; i < 2; i++) {
        root.debug("hello " + i);
      }    
      LogManager.shutdown();
    }
  }
  
  
  
  1.1                  logging-log4j/tests/src/java/org/apache/log4j/DailyRollingFileAppenderTest.java
  
  Index: DailyRollingFileAppenderTest.java
  ===================================================================
  /*
   * Created on May 28, 2004
   *
   * To change the template for this generated file go to
   * Window>Preferences>Java>Code Generation>Code and Comments
   */
  package org.apache.log4j;
  
  import org.apache.log4j.helpers.LogLog;
  
  import junit.framework.TestCase;
  
  /**
   * 
   * Test the original RollingFileAppender
   * 
   * @author Ceki Gulcu
   */
  public class DailyRollingFileAppenderTest extends TestCase {
   
    protected void setUp() throws Exception {
      super.setUp();
    }
    
    protected void tearDown() throws Exception {
      super.tearDown();
    }
   
    public DailyRollingFileAppenderTest(String arg0) {
      super(arg0);
    }
    
    public void testWriteFooter() {
      LogLog.setInternalDebugging(true);
      DailyRollingFileAppender drfa = new DailyRollingFileAppender();
      PatternLayout patternLayout = new PatternLayout("%m%n");
      patternLayout.setHeader("BEGIN\r\n");
      patternLayout.setFooter("END\r\n");
      drfa.setFile("output/test");
      drfa.setDatePattern("'.'yyyy-MM-dd-HH-mm-ss'.log'");
    
      drfa.setLayout(patternLayout);
      drfa.activateOptions();
      Logger root = Logger.getRootLogger();
      root.addAppender(drfa);
      
      for(int i = 0; i < 2; i++) {
        try { Thread.sleep(1100); } catch (Exception e) {}
        root.debug("hello " + i);
      }    
      LogManager.shutdown();
    }
  }
  
  
  

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