Created
January 3, 2013 22:04
-
-
Save anonymous/4447801 to your computer and use it in GitHub Desktop.
Event Sources, ETW and Event Viewer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-16"?> | |
<instrumentationManifest xsi:schemaLocation="http://schemas.microsoft.com/win/2004/08/events eventman.xsd" xmlns="http://schemas.microsoft.com/win/2004/08/events" xmlns:win="http://manifests.microsoft.com/win/2004/08/windows/events" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:trace="http://schemas.microsoft.com/win/2004/08/events/trace"> | |
<instrumentation> | |
<events> | |
<provider name="Company-Product-Module" guid="{11111111-3709-4551-821E-CF1DF1644D14}" symbol="company_product_module"> | |
<events> | |
<event symbol="ApplicationStart" value="1" version="0" channel="Company-Product-Module/Operational" level="win:Informational" task="win:None" opcode="win:Start" message="$(string.Company-Product-Module.event.1.message)" /> | |
<event symbol="ApplicationEnd" value="2" version="0" channel="Company-Product-Module/Operational" level="win:Informational" task="win:None" opcode="win:Stop" message="$(string.Company-Product-Module.event.2.message)" /> | |
</events> | |
<channels> | |
<channel name="Company-Product-Module/Operational" chid="Operational" symbol="Operational" type="Operational" enabled="true" /> | |
<channel name="Company-Product-Module/Admin" chid="Admin" symbol="Admin" type="Admin" enabled="true" /> | |
</channels> | |
</provider> | |
</events> | |
</instrumentation> | |
<localization> | |
<resources culture="en-US"> | |
<stringTable> | |
<string id="task.None" value="None" /> | |
<string id="opcode.Stop" value="Stop" /> | |
<string id="opcode.Start" value="Start" /> | |
<string id="level.Informational" value="Information" /> | |
<string id="Company-Product-Module.event.2.message" value="Application is stopping." /> | |
<string id="Company-Product-Module.event.1.message" value="Application is starting."/> | |
</stringTable> | |
</resources> | |
</localization> | |
</instrumentationManifest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Diagnostics.Tracing; | |
using System.Linq; | |
namespace ConsoleApplication1 | |
{ | |
class Program | |
{ | |
static void Main() | |
{ | |
ApplicationEvents.Log.ApplicationStart(); | |
Console.WriteLine("Hello world!"); | |
ApplicationEvents.Log.ApplicationEnd(); | |
} | |
} | |
[EventSource(Guid = "{1CE3FDBF-3709-4551-821E-CF1DF1644D14}")] | |
internal class ApplicationEvents : EventSource | |
{ | |
public static ApplicationEvents Log = new ApplicationEvents(); | |
[Event(1)] | |
public void ApplicationStart() { WriteEvent(1); } | |
[Event(2)] | |
public void ApplicationEnd() { WriteEvent(2); } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment