|
If any of this is incorrect or incomplete, please correct me or add the information so others may see.
In working on my current project involving KiX, I've been working with the forum on good coding practices for writing error logs to a network file location. In this endeavor, I've come across a peculiar problem; Windows appeared to be "locking" files when multiple people were writing to the same file at once.
In my case, when a user logs onto the network, this script runs. If at any of the key points it fails, it writes an error log to a network share in the format of "current_date.xls". The information that was logged was the information contained in @ERROR and @SERROR along with the computer name, user, and time of the error. When I was writing the file to .doc's and .xls files, I'd have massive extra log files in my directory outside of the current date. It seems that when using any office extension to write your log file, Windows locks the file while it's in use so no one else can write to it.
So... in playing around with different formats, it appears this problem only pertains to file extensions where that extension is configured to open up with an Office Suite program. If you use an extension like .log or .txt, one that is not commonly opened by Office apps, your log file should work fine. I'm using .log and have yet to get an extra file to appear.
|