异常日志文件的最佳位置(Windows) [英] Best location for exception log files (Windows)

查看:112
本文介绍了异常日志文件的最佳位置(Windows)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在这里已经讨论了一两次(或更多)异常日志的问题,建议之一是应用程序永远不要写入安装文件夹.
但是,如果我将日志放在%appdata%中的某处,则意味着每个用户都有自己的日志集.我希望所有日志都放在一个位置.
在最后一个MSDN杂志问题中,在安装文件夹中有一个单独的日志子文件夹(例如,%programfiles \ myapp \ logs)被称为规则中的有效例外.当然,必须相应地设置此文件夹的ACL.
在安装文件夹中是否有日志文件夹是惯例还是绝对不行?您将异常日志放在哪里?

The question where exception logs should go has been discussed here once or twice (or more), and one of the recommendation was that the application should never write to the installation folder.
However, if I put the logs somewhere in %appdata%, this means that each user has its own set of logs. I'd prefer having all logs at a single location.
In one of the last MSDN mag issues, having a separate sub folder for logs in the installation folder (e.g. %programfiles\myapp\logs) was called a valid exception from the rule. Of course, the ACL for this folder must be set up accordingly.
Is having a log folder in the installation folder common practice or an absolute no-go? Where do you put your exception logs?


实际上,我们正在使用log4net,因此日志记录的位置和类型是完全可配置的.但是,我想要一个合理的默认值. 我更喜欢在事件日志中放一个文件.对于大多数用户而言,文件比事件日志更容易处理.
但是,假设我要拥有文件.在安装文件夹中有一个日志文件夹可以吗?


In fact, we are using log4net, so the location and type of logging is completely configurable. However, I want to have a reasonable default. I prefer having a file over the event log. For most users, a file is much easier to handle than the event log.
However, let's assume that I want to have files. Is it okay to have a log folder in the installation folder?

推荐答案

使用较新的OS Vista和Win 2008,可能需要ACL或将其虚拟化到用户的文件夹中才能写入程序文件目录.我建议您在%AllUsersProfile%下设置一个目录,这样您就可以为所有用户的日志文件使用一个公用位置,并且您的应用程序无需以管理员身份运行即可在其中写入它们.

With the newer OS vista and win 2008 writing to the program files directory may need ACL or be virtualized to the user's folder. I would suggest setting up a directory under %AllUsersProfile% this way you have one common location for all user's log files and your applications does not need to run as admin to write them there.

这篇关于异常日志文件的最佳位置(Windows)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆