diff --git a/fhem/FHEM/92_FileLog.pm b/fhem/FHEM/92_FileLog.pm index 26b83c77e..c945dc5b4 100755 --- a/fhem/FHEM/92_FileLog.pm +++ b/fhem/FHEM/92_FileLog.pm @@ -100,6 +100,9 @@ FileLog_Log($$) my $max = int(@{$dev->{CHANGED}}); my $tn = TimeNow(); my $ct = $dev->{CHANGETIME}; + my $wrotesome; + my $fh = $log->{FH}; + for (my $i = 0; $i < $max; $i++) { my $s = $dev->{CHANGED}[$i]; $s = "" if(!defined($s)); @@ -109,12 +112,14 @@ FileLog_Log($$) FileLog_Switch($log); - my $fh = $log->{FH}; print $fh "$t $n $s\n"; - $fh->flush; - $fh->sync if !($^O eq 'MSWin32'); #not implemented in Windows + $wrotesome = 1; } } + if($wrotesome) { + $fh->flush; + $fh->sync if !($^O eq 'MSWin32'); #not implemented in Windows + } return ""; } @@ -513,11 +518,11 @@ seekTo($$$$) FHEM also replaces %L by the value of the global logdir attribute.
Before using %V for ISO 8601 week numbers check if it is