我应该多久写入一次Windows中的事件日志?

How often should I write to the Event Log in Windows?
2020-10-17
  •  译文(汉语)
  •  原文(英语)

我有一个自动化的流程,它将每小时执行一次特定任务.我正在考虑为此创建一个日志,该日志将允许用户查看(如果需要)正在使用的值.我应该在事件日志中执行此操作还是为此创建一个.log txt文件?

是否有Windows事件日志的指南,以及是否仅应将其用于错误?

如果我每小时写入一次事件日志,应该注意什么问题?

解决过程1

首先一行回答问题

我应该多久写入一次Windows中的事件日志

这取决于您的需求和获取信息的频率.万一日志记录决策没有"一刀切"的选择.

我应该在事件日志中执行此操作还是为此创建一个.log txt文件?

取决于您的要求以及谁将使用日志.要考虑事件日志,您确定您的应用程序每次都有权访问事件日志吗?(简单来说,就是管理特权).

如果没有定义一组标准(假设您不是仅将其编写供个人使用),则应在组织中为在事件日志中写入的内容和在日志文件中写入的内容设置约定/标准.

例如,事件日志:未处理的异常和警告日志文件:捕获的异常和常规信息(以便在任何已部署的应用程序客户端中都可以通过邮件向您发送日志文件)

是否有指南Windows事件日志以及是否仅应将其用于错误

您可以访问企业日志库:

https://msdn.microsoft.com/zh-CN/library/dn169621.aspx

编辑:

**为什么无缘无故地投票!!! **

I have an automated Process that will run a certain task every hour. I am thinking of creating a logging for this that would allow the user to see, if they want, what values are being used. Should I do this in the Event Log or create a .log txt file for this?

Is there a guideline for Windows Event Logs and whether it should only be used for errors only?

Are there any issues that I should be on the lookout for if I write to the event log every hour?

Solutions1

First of all one line answer to question

How often should I write to the Event Log in Windows

It depends on your needs and frequency at which you want information. There is no "one size fits all" in case logging decisions.

Should I do this in the Event Log or create a .log txt file for this?

depends on your requirements and who is going to use the log. To consider the Event Log, are you sure your application will have access to write event log every time? (in simple words, Administrative privileges).

If there are no set of standards defined (assuming you are not writing it for personal use only), then you should set a convention/standard in place for organization for what to write in Event Log and what to write in Log file.

For example Event log: Unhanded exceptions and warnings Log file: Caught exception and General Information (so that if in any deployed app client can send you the log file on mail)

Is there a guideline Windows Event Logs and whether it should only be used for errors only

You can visit Enterprise logging library:

https://msdn.microsoft.com/en-us/library/dn169621.aspx

Edit:

**Why downvote without a reason !!! **

转载于:https://stackoverflow.com/questions/30838337/how-often-should-i-write-to-the-event-log-in-windows

本人是.net程序员,因为英语不行,使用工具翻译,希望对有需要的人有所帮助
如果本文质量不好,还请谅解,毕竟这些操作还是比较费时的,英语较好的可以看原文

留言回复
我们只提供高质量资源,素材,源码,坚持 下了就能用 原则,让客户花了钱觉得值
上班时间 : 周一至周五9:00-17:30 期待您的加入