in reply to Find a filename in a text file

I didn't see a value for $LogFileName in your script. Did it run with warnings enabled?