Hello,
im trying to search log-file by using StringRegExp.
The script reads a line in the log-file and if the mask matches the line, the script sends an email. Sending emails works fine. And the other stuff too.
Sometimes the script crashes, I tried to trace it and I think the reason is the StringRegEx function. I see no reason, why the script crashes. It doesnt crash always.
Its really weird. If I just put in a comment line somewhere in the script, it may not crash any more. If I put in another comment line somewhere else it may crash again.
Does anybody have an idea?
I think its helpful for you to see some code.
Here it is.
For $i = 0 To $maskenanzahl - 1 Step 1
;counts the matches
Local $anzahlTreffer = 0
Local $file = FileOpen($tempLogDatei, 0)
If $file == -1 Then
;logs the text
_logge("Fehler beim FileOpen")
Else
_logge("Datei geöffnet")
While 1
Local $line = FileReadLine($file)
If @error == -1 Then
ExitLoop
ElseIf @error == 1 Then
_logge("Fehler bei FileReadLine")
EndIf
If StringRegExp($line, $maske[$i], 0, 1) Then
$anzahlTreffer = $anzahlTreffer + 1
;sends an email
_emailSenden($line, $i+1)
ElseIf @error == 2 Then
_logge("Fehler bei RegExp " & @error)
EndIf
WEnd
FileClose($file)
EndIf
_logge("Maske" & $i + 1 & " lieferte " & $anzahlTreffer & " Treffer")
Next
_logge("Filterung abgeschlossen")
Thanks for helping.
Ben
PS: Some lines are very long (about 1000 chars). Does it have any effect?