I'd like some advise on a fool proof logging system. I have a windows
app and need key events to be logged to a text file. Here are the
REQUIREMENTS I have been given--generally requirements I'm given are
non-negotiable.
--It might be hours or days between logging events or just split seconds.
--This application will be run from a network drive and the log file
will reside in the directory it is run from.
--This same exe will be run on multiple pcs at the same time and mabye
even run multiple times on the same pc. All running instances of this
app running must use the same log file.
--The log file is to be appended to.
--The log file must be able to be opened in notepad while it's being
written to. I understand opening it will only show me what's in it at
the moment it's opened.
--Trying to write to the log file must never stop the program from
running (well more than a couple of seconds). If worst come to worst
and an event can not be logged in a couple of tries don't log it.
Can anyone give me any ideas on how to do this?
I see potential problems with more than one instance of the app trying
to write at the same time and also with the file being open in notepad
when an app tries to write to it. On the up side the longest lines
being written will be exception.message text returned if an error occurs.