At 09:52 PM 8/21/2001 +0200, Ceki Gülcü wrote:
>Scott,
>
>I don't think you are the first nor the last user of FileAppender. It's
>been around for a while...
True enough, which was why I was surprised by the lack of output when the
program was killed under Windows. I can't have been the first to try this.
>The FileAppender flushes immediately by default. I suspect that the
>problem lies with your application. Regards, Ceki
Do you have any suggestions about how to isolate the problem? The only
log4j-specific calls in my program are:
package com.isisph.bioinfo.general.POV;
import org.apache.log4j.Category;
import org.apache.log4j.PropertyConfigurator;
public class PlugableObjectViewer extends JFrame {
static Category cat =
Category.getInstance(PlugableObjectViewer.class.getName());
static {
PropertyConfigurator.configure("pov.lcf");
}
public static void main(String args[]) {
cat.info("Starting POV");
// Other code that starts threads and does things goes here
// Could mimic with a sleep(60000);
}
}
One interesting isolation step - run the above and see if after hitting ^C
and killing the process prevents the log file from being written. If so,
this might be a Sun bug, while if not, it may be something particular to my
system.
Scott
>At 11:16 21.08.2001 -0700, you wrote:
> >Hi, again.
> >
> >I sent this a few days ago, but I did not see it come back from the
> list, so I am assuming that it got eaten.
> >
> >I have a project in which we have used log4j extensively. Our program
> logs a message on start, so there should be something in the log file
> pretty much instantly, but it appears that if the program is halted
> suddenly, the log file will be completely empty.
> >
> >I have tried halting it by closing the Java launcher DOS window, and I
> note that I then get an empty log file. This is true even if the program
> has been running for five or ten minutes. I am using a plain old
> FileAppender, which inherits from WriterAppender, and thus ImmediateFlush
> should force the writes to take place within seconds at most.
> >
> >If I do not kill the process, then the writes take place either when we
> have a few k in the log buffer, or when the process terminates
> gracefully. This is normal behavior for buffered output, but I even
> tried explicitly setting ImmediateFlush to see if that made a difference.
> >
> >NB - there is quite a bit of time where the program sits idle, so I know
> that the initial message is not getting swallowed by threading or
> something similarly vile.
> >
> >I have tried both 1.1.3 and 1.1.2.
> >
> >So, can anyone confirm that FileWriter is honoring the immediate flush
> requests under Windows and JDK 1.3.1?
> >
> >The config file is below.
> >
> >log4j.rootCategory=DEBUG, A_log
> >
> >log4j.appender.A_log=org.apache.log4j.FileAppender
> >log4j.appender.A_log.Threshold=DEBUG
> >log4j.appender.A_log.File=pov.log
> >log4j.appender.A_log.ImmediateFlush=true
> >log4j.appender.A_log.Append=false
> >log4j.appender.A_log.layout=org.apache.log4j.PatternLayout
> >log4j.appender.A_log.layout.ConversionPattern=%d (%r) %-5p %-30c{2} - %m\n
> >
> >log4j.category.com.isisph.bioinfo.general.POV=DEBUG
Scott Ellsworth
[EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]