in reply to Do I need to lock log files?
On my NT machine (P233) 1000 is enough, and takes a few seconds to run. On a solaris machine, 10,000 is needed to give me a few seconds to start multiple copies.<PR> One interesting result of this program is that the times are not necesarily in order. But since all you are doing is writing to the end of the file, the OS seems to take care of it all.#!/usr/local/bin/perl -w my $file = 'd:\log_test'; my $version = $ARGV[0]?$ARGV[0]:'0'; my $count = 0; while ($count++ < 1000) { open OUT, ">>$file" or die "Could not open file $count\n$!\n"; print OUT time," $version lots of useless text $count\n"; close OUT; }
|
|---|