Created
December 16, 2014 17:16
-
-
Save niemyjski/469ccce03dc5b753d522 to your computer and use it in GitHub Desktop.
Exceptionless Log Source Trace Messages
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
internal static readonly TraceSource _traceSource = new TraceSource("MyLogSource"); | |
ExceptionlessTraceListener traceListener = Trace.Listeners.OfType<ExceptionlessTraceListener>().FirstOrDefault(); | |
if (traceListener != null) | |
_traceSource.Listeners.Add(traceListener); | |
OR | |
<system.diagnostics> | |
<sharedListeners> | |
<add name="DiskLog" type="System.Diagnostics.TextWriterTraceListener" traceOutputOptions="DateTime" initializeData="MyLog.log" /> | |
<add name="Exceptionless" type="Exceptionless.Diagnostics.ExceptionlessTraceListener, Exceptionless" traceOutputOptions="DateTime" initializeData="25" /> | |
</sharedListeners> | |
<sources> | |
<source name="MyLogSource" switchValue="All"> | |
<listeners> | |
<add name="DiskLog"/> | |
<add name="Exceptionless"/> | |
</listeners> | |
</source> | |
</sources> | |
<trace autoflush="true" useGlobalLock="true"> | |
<listeners> | |
<add name="Exceptionless" /> | |
</listeners> | |
</trace> | |
</system.diagnostics> | |
OR (Include just your log source) | |
Wireup to the exceptionless sending event. Grab the Listener from your trace source and attach it as extended data. | |
<system.diagnostics> | |
<sharedListeners> | |
<add name="DiskLog" type="System.Diagnostics.TextWriterTraceListener" traceOutputOptions="DateTime" initializeData="MyLog.log" /> | |
<add name="Exceptionless" type="Exceptionless.Diagnostics.ExceptionlessTraceListener, Exceptionless" traceOutputOptions="DateTime" initializeData="25" /> | |
</sharedListeners> | |
<sources> | |
<source name="MyLogSource" switchValue="All"> | |
<listeners> | |
<add name="DiskLog"/> | |
<add name="Exceptionless"/> | |
</listeners> | |
</source> | |
</sources> | |
</system.diagnostics> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment