@@ -23,7 +23,7 @@ the web.config Exceptionless section.
23
23
24
24
<exceptionless apiKey="API_KEY_HERE" />
25
25
26
- Finally , you must import the "Exceptionless" namespace and call the following line
26
+ Next , you must import the "Exceptionless" namespace and call the following line
27
27
of code to start reporting unhandled exceptions. You will need to run code during
28
28
application startup and pass it an HttpConfiguration instance. Please note that this
29
29
code is normally placed inside of the WebApiConfig classes Register method.
@@ -34,6 +34,23 @@ If you are hosting Web API inside of ASP.NET, you would register Exceptionless l
34
34
35
35
Exceptionless.ExceptionlessClient.Default.RegisterWebApi(GlobalConfiguration.Configuration)
36
36
37
+ Finally, if you are targetting WebApi 2.1 or newer you will need to copy the following
38
+ ExceptionLogger into your project and register it as a service.
39
+
40
+ using Exceptionless.Plugins;
41
+ public class ExceptionlessExceptionLogger : ExceptionLogger {
42
+ public override void Log(ExceptionLoggerContext context) {
43
+ var contextData = new ContextData();
44
+ contextData.MarkAsUnhandledError();
45
+ contextData.SetSubmissionMethod("ExceptionLogger");
46
+ contextData.Add("HttpActionContext", context.ExceptionContext.ActionContext);
47
+
48
+ context.Exception.ToExceptionless(contextData).Submit();
49
+ }
50
+ }
51
+
52
+ config.Services.Add(typeof(IExceptionLogger), new ExceptionlessExceptionLogger());
53
+
37
54
Please visit the wiki https://github.com/exceptionless/Exceptionless.Net/wiki/Sending-Events
38
55
for examples on sending events to Exceptionless.
39
56
0 commit comments