zoukankan      html  css  js  c++  java
  • C# create Windows event logs by EventLog.

    1. What's Windows event logs.

    A: MSDN event logs http://support.microsoft.com/kb/308427

      

    • Application log

      The application log contains events logged by programs. For example, a database program may record a file error in the application log. Events that are written to the application log are determined by the developers of the software program.
    • Security log

      The security log records events such as valid and invalid logon attempts, as well as events related to resource use, such as the creating, opening, or deleting of files. For example, when logon auditing is enabled, an event is recorded in the security log each time a user attempts to log on to the computer. You must be logged on as Administrator or as a member of the Administrators group in order to turn on, use, and specify which events are recorded in the security log.
    • System log

      The system log contains events logged by Windows XP system components. For example, if a driver fails to load during startup, an event is recorded in the system log. Windows XP predetermines the events that are logged by system components.

    2.  We create an user-defined Log.

      

    using  System.Diagnostics
    EventLog.WriteEntry(
    "A1", uninstallCmd);


     3. Now we can see the log file in windows.

     

  • 相关阅读:
    java 异常练习题1
    java 异常练习题
    java 抽象类
    java 接口练习题6
    java 接口练习题5
    java 接口练习题4
    java 接口练习题3
    java接口练习题2
    java 接口练习题1
    java 泛型
  • 原文地址:https://www.cnblogs.com/zencorn/p/1887618.html
Copyright © 2011-2022 走看看