Windows log generator
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.
- Create a new Project in Visual Studio.
- 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>
- 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"); } } }
Run your application.
Check your Windows Event log.
If you need EXE file you can find in your Documents\visual studio 2015\your project
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)
精彩评论