Folder to dump windows service log files

4.2k views Asked by At

Short: What's the most appropriate folder for windows service to dump log files into?

Details

I have a windows service that produces log files that a low-tech end user might be interested to look at (actual communication between a computer and a manufacturing line monitoring sensors).

The computer is a stand-alone dedicated computer that acts as a data acquisition server, it has monitor and accessible to the end user, but not meant to be touched unless there are problems.

What's the best (most appropriate) place (folder) to output those log files to?

My considerations are:

  1. ease of configuration (in case I have to give an access for local services account to that folder).
  2. ease of access for an end user (again: they shouldn't need to, but occasionally they might want to).

EDIT: It creates about 10 up to 1Mb rolling size files. There is no issue with size, so no compression and clean-up is necessary.

3

There are 3 answers

1
Eight-Bit Guru On BEST ANSWER

My preference is to make use of the All Users folder structure. By creating a folder in there with the same name as your service app, it's readily apparent where the contents come from, you can grant access to it without compromising the Program Files folder, and when you uninstall or upgrade your app you won't leave 'orphan' folders in Program Files that couldn't be removed because the installer didn't know it had to delete some log files.

5
Kyle Rosendo On

Well, I'd say where your service installed to, in a /Logs/ folder. Then add functionality to compress these files at a later stage.

By doing this, you're not splitting up your applications data from the actual running application. For instance, saving this to C:\LogDumps\ gives no indication of what program created the files in the first place and would be a nightmare to maintain.

4
Andy White On

I think the most intuitive place to log is a sub-folder "Logs" within the folder where the service is installed. For example, if the service is installed here:

c:\program files\my company\my service\

Put the logs here:

c:\program files\my company\my service\logs\

I don't like it when applications log to the "Documents and Settings" or "My Documents" areas - I don't like having crap that I didn't create in a folder that is supposed to be My Documents.