tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@swapsimple.com
Subject Re: Rotating catalina.out with Webmin
Date Mon, 15 Nov 2004 22:41:02 GMT
On Mon, Nov 15, 2004 at 03:39:01PM -0600, Filip Hanik - Dev wrote:
> this was not the case when using a java.io.FileOutputStream(), so I assume you tried
and verified this :)

	You are confused.  It _is_ the case with FileOutputStream.  The only
way it could be otherwise is if the output stream re-opens the file, either
on every write, or when it notices that the file name no longer refers to
the same file.

Create aa.java with this code:

import java.io.*;
public class aa
{
    public static void main(String[] args) throws Exception
    {
        FileOutputStream f = new FileOutputStream(args[0]);
        f.write(80); f.flush();
        synchronized(f) { f.wait(5 * 1000); }
        f.write(81); f.flush();
    }
}

And run this:
java aa foo &
mv foo bar

Notice that the output of the second write (which occurs after the file
is renamed) is in the original file (bar), not in a new foo.

eric

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message