在Windows中,应用程序事件日志中有哪些默认事件源? [英] In Windows, what default event sources are available in the Application Event Log?

查看:154
本文介绍了在Windows中,应用程序事件日志中有哪些默认事件源?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

简短版本:

应用程序事件日志中是否始终包含事件源应用程序和应用程序错误?它们在新安装的Windows XP,Vista和Windows 7上可用吗?使用它们而不是创建自己的资源(对我来说是不可能的)真的很不好吗?

Are the event sources "Application" and "Application Error" always included in the Application Event Log? Are they available on new installations of Windows XP, Vista and Windows 7? Would it be really bad to use them instead of creating my own source (an impossibility for me)?

长版:

我有一个ClickOnce应用程序,供没有计算机管理员权限的用户使用。

I have a ClickOnce application that is used by users without administrative privileges on their machines.

当我尝试写入Appliction事件日志,我收到一个安全异常。 (Windows事件日志记录基础结构正试图为我创建一个新的事件源,并违反了安全性。)

When I try to write to the Appliction Event Log, I get a security exception. (The Windows event logging infrastructure is trying to create me a new event source, and gets a security violation.)

所以我想尝试重用现有的事件源。我在应用程序事件日志中仅找到两个通用来源。这些都是Windows安装的一部分,并且会做出合理的选择吗?

So I would like to try reusing an existing event source. I have found a only two"generic-sounding" sources in the Application Event Log. Are these always part of a Windows installation, and would make a reasonable choice?

  • 应用程序
  • 应用程序错误

  • Application
  • Application Error

    我肯定对此不满意,因为我应该使用自己的事件源来区分我的应用程序。但这是针对偶发性致命错误的,我的代码应该将其记录在其他地方。我只是想在客户端计算机上找到一个非常容易的地方,以防万一一切出错...

    I am sure this is frowned upon, as I should distinguish my application using its own event source. But this is for infrequent fatal errors, which should be getting logged elsewhere by my code. I just want a really easy place to find them on a client machine in case it all goes wrong...

    推荐答案


    当我尝试写入Appliction事件日志时,出现安全异常。 (Windows事件日志记录基础结构正试图为我创建一个新的事件源,并违反了安全性。)

    When I try to write to the Appliction Event Log, I get a security exception. (The Windows event logging infrastructure is trying to create me a new event source, and gets a security violation.)

    我刚刚回答了在这里:在ClickOnce应用程序中使用EventLog

    I have just answered this here: Using EventLog in ClickOnce application


    所以我想尝试重用现有的事件源。我在应用程序事件日志中仅找到两个通用来源。这些始终是Windows安装的一部分,并且会做出合理的选择吗?

    So I would like to try reusing an existing event source. I have found a only two"generic-sounding" sources in the Application Event Log. Are these always part of a Windows installation, and would make a reasonable choice?

    这样做真的不明智。 Windows应用程序或第三方应用程序将使用现有事件源。如果其中的任何一个被删除或被Service Pack或补丁之类的东西更改,则您的程序将崩溃,除非您实施了异常处理以优雅地处理该异常,但是您将没有任何事件记录。

    It's really not wise to do this. Existing event sources will be used by either Windows applications, or by third party applications. If any of those are removed, or changed by something like a service pack or patch, your program will crash unless you have implemented exception handling to handle the exception gracefully, but then you wont have any event logging.

    还要考虑将应用程序移植到下一版本Windows可能要做的工作。我建议您会自己动手做。

    Also consider the work you may have to do to port your app to the next version of Windows. I suggest you will be making a rod for your own back.

    在我链接的答案中,我建议解决问题的最佳方法是安装应用程序

    In the answer I linked to, I suggested the best way to handle the problem, is to install your application using admin privs with the installer creating the source, or by creating a simple app that effectively does the same using the admin role.

    我唯一可以建议的是始终以管理员模式运行您的应用程序。

    The only thing else I can suggest is to always run your application in admin mode.

    这篇关于在Windows中,应用程序事件日志中有哪些默认事件源?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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