ADDED: Call Prolog on OpenFileEvent
MODIFIED: Open logfile depending on environment variable.  This
avoids poluting the directories with logfiles.