-
Bug
-
Resolution: Not an Issue
-
P4
-
None
-
6u1
-
x86
-
linux
FULL PRODUCT VERSION :
java version "1.6.0_01"
Java(TM) SE Runtime Environment (build 1.6.0_01-b06)
Java HotSpot(TM) 64-Bit Server VM (build 1.6.0_01-b06, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux ootbsvr 2.6.16.21-0.13-smp #1 SMP Mon Jul 17 17:22:44 UTC 2006 x86_64 x86_64 x86_64 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
Start two JVMs, both logging to the same file, and watch them stomp over each other.
I'm trying to use the Logging api to get test data from two cooperating programs, so I can compare the output against known-correct output.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run
java LoggingStdout 100 & java LoggingStdout 50
then look at log.txt
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
intermingled log entries in log.txt
ACTUAL -
50 log entries from one program, followed by the last 50 from the other program
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.io.IOException;
import java.util.logging.*;
// Run like this:
// java LoggingStdout 100 & java LoggingStdout 50
public class LoggingStdout {
public static void main(String[] args) throws IOException {
Formatter formatter = new SimpleFormatter();
FileHandler fh = new FileHandler("log.txt", true) {
@Override
public synchronized void publish(LogRecord record) {
super.publish(record);
flush();
}
};
fh.setFormatter(formatter);
Logger.global.addHandler(fh);
Logger.global.setLevel(Level.FINEST);
String id = "" + (System.nanoTime() / 10000) % 100000000;
int count = Integer.parseInt(args[0]);
System.out.println(id + " count = " + count);
for (int num = 0; num < count; ++num) {
Logger.global.finest(id + "\n");
try { Thread.sleep(10); } catch (InterruptedException e) { }
}
}
}
---------- END SOURCE ----------
java version "1.6.0_01"
Java(TM) SE Runtime Environment (build 1.6.0_01-b06)
Java HotSpot(TM) 64-Bit Server VM (build 1.6.0_01-b06, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux ootbsvr 2.6.16.21-0.13-smp #1 SMP Mon Jul 17 17:22:44 UTC 2006 x86_64 x86_64 x86_64 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
Start two JVMs, both logging to the same file, and watch them stomp over each other.
I'm trying to use the Logging api to get test data from two cooperating programs, so I can compare the output against known-correct output.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run
java LoggingStdout 100 & java LoggingStdout 50
then look at log.txt
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
intermingled log entries in log.txt
ACTUAL -
50 log entries from one program, followed by the last 50 from the other program
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.io.IOException;
import java.util.logging.*;
// Run like this:
// java LoggingStdout 100 & java LoggingStdout 50
public class LoggingStdout {
public static void main(String[] args) throws IOException {
Formatter formatter = new SimpleFormatter();
FileHandler fh = new FileHandler("log.txt", true) {
@Override
public synchronized void publish(LogRecord record) {
super.publish(record);
flush();
}
};
fh.setFormatter(formatter);
Logger.global.addHandler(fh);
Logger.global.setLevel(Level.FINEST);
String id = "" + (System.nanoTime() / 10000) % 100000000;
int count = Integer.parseInt(args[0]);
System.out.println(id + " count = " + count);
for (int num = 0; num < count; ++num) {
Logger.global.finest(id + "\n");
try { Thread.sleep(10); } catch (InterruptedException e) { }
}
}
}
---------- END SOURCE ----------