eventlog.exists不适用于安装事件日志? [英] eventlog.exists not working for setup event log ?

查看:83
本文介绍了eventlog.exists不适用于安装事件日志?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在使用 导出事件日志ExportLogAndMessages()方法但是在使用EventLog.Exists(LogName)方法检查事件日志是否存在之前,它对"应用程序","安全"和"安全"工作正常。日志,但当我检查
的"设置"时它在检查时会丢失假值但是"设置"机器上有日志。

为什么重新调整是假的?

检查机器上可用事件的其他方法是什么?

TIA


下面是我的代码

 if(EventLog.Exists(LogName))
{
EventLogSession logsession = new EventLogSession();
logsession.ExportLogAndMessages(LogName,PathType.LogName," *",subfolderpath,false,CultureInfo.CurrentCulture);

}

解决方案

< blockquote>

您好,


感谢您发布此处。


根据错误消息,您是否检查了日志是否存在本地计算?


您是否检查本地计算机上是否存在源,请使用
SourceExists
? 


我建议您使用管理员来运行该应用程序。 因为此方法访问注册表,您必须在本地计算机上具有相应的注册表权限;否则,查询返回
false。 


据我所知,要搜索的日志方法的名称。可能的值包括:
应用程序,安全性,系统,其他特定于应用程序的日志(例如与Active Directory关联的日志)或计算机上的任何自定义日志。


也许设置超出了它的范围。


注意:您可以使用该命令访问设置日志。有关详细信息,请参阅

Windows安装日志文件和事件日志


最好的问候,


Hart



Hi all,
i am exporting event log using  ExportLogAndMessages() method but before im checking that event log is exist or not using EventLog.Exists(LogName) methods it is working fine for "Application", "Security" logs but when i am checking for "Setup" it is returing false value while checking but "Setup" log is available in machine.
why is is retuning false?
any other method to check events available on machine or not?
TIA

below is my code

if (EventLog.Exists(LogName))
{
EventLogSession logsession = new EventLogSession();
logsession.ExportLogAndMessages(LogName, PathType.LogName, "*", subfolderpath, false, CultureInfo.CurrentCulture);

}

解决方案

Hi,

Thank you for posting here.

According to the error message, did you check whether the log exists on the local compute?

Did you check whether the source exists on the local computer, use SourceExists

I suggest that you can use the administrator to run the application.  Because this method accesses the registry, you must have the appropriate registry permissions on the local computer; otherwise, the query returns false. 

As far as I know that the name of the log method to search for. Possible values include: Application, Security, System, other application-specific logs (such as those associated with Active Directory), or any custom log on the computer.

Maybe the setup has beyond its scope.

Note: you can use the command to access the setup log. About more information, please see the Windows Setup Log Files and Event Logs

Best Regards,

Hart


这篇关于eventlog.exists不适用于安装事件日志?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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