开发者

Folder to dump windows service log files

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:

    开发者_JAVA技巧
  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.


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.


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜