开发者

Windows log generator

开发者 https://www.devze.com 2023-01-20 07:37 出处:网络
Is there a way to generate specific Windows events? I\'m currently developing a solution to get this events through WMI process, but I need all the logs Windows can generate.

Is there a way to generate specific Windows events?

I'm currently developing a solution to get this events through WMI process, but I need all the logs Windows can generate.

I know there is a way to make .net solution to write the events to the event viewer, but I don't want that.

Is there a way to code or make a solution to make Windows to generate the even开发者_如何学Cts? Or what any other approach do you recommend me?


No. The events are not generated by Windows itself -- Windows is just reporting what the underlying application said it wanted to put into the event log. You would have to lookup documentation on the various events every given Windows component could generate, because that is the domain of each specific component, not of the event logging system itself.


You can create a simple listener in Visual Studio 2015 that directs your output to a Windows EventLog.

  1. Create a new Project in Visual Studio.
  2. Open App.config and add Listener's configuration
<system.diagnostics>
  <trace autoflush="false" indentsize="4">
    <listeners>
      <add name="myListener"
        type="System.Diagnostics.EventLogTraceListener"
        initializeData="TraceListenerLog" />
    </listeners>
  </trace>
</system.diagnostics>

Windows log generator

  1. Go to your main Program.cs file and the following code
using System.Diagnostics;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            Trace.WriteLine("Test output");
        }
    }
}

Windows log generator

  1. Run your application.

    Windows log generator

  2. Check your Windows Event log.

    Windows log generator

  3. If you need EXE file you can find in your Documents\visual studio 2015\your project

    Windows log generator


No you can't generate Windows events.

But if you want to find out what events you might encounter - have a look at the following for a complete list of Windows Events:

Security Event Descriptions (Microsoft Site)

Windows Security Log Events (Ultimate Windows Security)

0

精彩评论

暂无评论...
验证码 换一张
取 消