logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 42933] - IllegalStateException thrown from FileAppender.closeFile() when log file is actively being tailed
Date Fri, 05 Oct 2007 06:15:09 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42933>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42933





------- Additional Comments From jlindwall@yahoo.com  2007-10-04 23:15 -------
We are also seeing this problem but with Log4j's DailyRollingFileAppender and 
FileAppender.  It occurs in jdk 1.5.0_11 and jdk1.5.0_13 but not in 
j2sdk1.3.1_20.

Here is a dorky test program to reproduce it:

import org.apache.log4j.FileAppender;
import org.apache.log4j.Logger;
import org.apache.log4j.Priority;
import org.apache.log4j.PatternLayout;
import org.apache.log4j.spi.LoggingEvent;

public class TailBug
{
    public static void main(String[] args) throws InterruptedException
    {
        final String filename = "tailme";

        FileAppender fa = new FileAppender();
        fa.setName("myappender");
        fa.setFile(filename);
        fa.setLayout(new PatternLayout("%d %m%n"));
        fa.activateOptions();

        writeSomeMessages(fa);

        System.out.println("NOW Start tailing " + filename + "!!!!!\n");
        System.out.println("The logfile will be rotated to in 10 seconds");

        Thread.sleep(10000);

        final String newfilename = "tailme2";

        fa.setFile(newfilename);
        fa.activateOptions();   // Exception will be thrown here

        writeSomeMessages(fa);

        System.out.println("Done!");
    }

    private static void writeSomeMessages(FileAppender fa)
    {
        System.out.println("Logging 5 messages to file " + fa.getFile() 
+ "...\n");
        for( int i = 0; i < 5; i++ )
        {
            fa.append(new LoggingEvent("", Logger.getLogger("log"), 
Priority.WARN, "This is a test message", null));
        }
    }
}


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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