DOCUMENTATION
ASP.NET WebApi
See the basic setup steps below to get started with the Logify Alert service:
The following additional steps may be required, based on your application deployment strategy and logging service preferences:
Generate an API Key
The Logify Alert service uses unique identifiers – API keys – to register and monitor individual applications. You will use this key later when creating an instance of Logify Alert client in code.
-
Log in to the Logify Alert website: logify.devexpress.com.
-
Switch to the Applications tab and click Create New Application.
-
Specify the application name and description, then click Create.
-
The Applications tab will now display a new entry with an auto-generated API key.
Send Reports to Logify Alert
This section explains how to modify your ASP.NET WebForms or MVC application so that it reports unhandled exceptions to the Logify Alert service.
Add the Logify Alert Client to Your Project
Select Tools | NuGet Package Manager | Package Manager Console in the Visual Studio main menu and execute the following command.
Install-Package Logify.Alert.Web
Enable Automatic Reporting
To automatically intercept all unhandled exceptions and send corresponding crash reports to Logify Alert, follow the steps below.
-
Specify an API Key to register your application within the Logify Alert service. You can do this in a configuration file (it is automatically changed when you install a NuGet package containing a Logify Alert client) or in code.
Change the <configuration> section in the Web.config file.
<configuration> <configSections> ... <section name="logifyAlert" type="DevExpress.Logify.WebLogifyConfigSection, Logify.Alert.Web"/> ... </configSections> ... <logifyAlert> <apiKey value="SPECIFY_YOUR_API_KEY_HERE"/> </logifyAlert> </configuration>
Use the following code inside the Application_Start event handler.
using DevExpress.Logify.Web; // ... LogifyAlert.Instance.ApiKey = "SPECIFY_YOUR_API_KEY_HERE";
-
Change the <modules> section in the Web.config file.
<system.webServer> <modules> ... <add name="Logify.Alert.Web" type="DevExpress.Logify.Web.AspExceptionHandler, Logify.Alert.Web" preCondition="managedHandler"/> ... </modules> </system.webServer>
-
Add the following code to the end of the Register(HttpConfiguration config) method declared in the application's WebApiconfig.cs file.
public static class WebApiConfig { public static void Register(HttpConfiguration config) { //... config.Filters.Add(new DevExpress.Logify.Web.WebApiExceptionHandler()); } }
Manual Reporting
Use the following code to catch exceptions and send reports manually.
using DevExpress.Logify.Web;
try {
// Some code
}
catch (Exception ex){
LogifyAlert client = LogifyAlert.Instance;
client.ApiKey = "SPECIFY_YOUR_API_KEY_HERE";
client.Send(ex);
}
Rebuild and Run Your Application
Once your updated application has been redeployed, log in to logify.devexpress.com to review and process incoming reports.
Manual Application Deployment
Skip this step if you are using Visual Studio’s integrated application deployment mechanism. Since you have added Logify Alert client to the project using NuGet, all necessary DLLs will automatically be deployed.
If you are not using Visual Studio’s deployment mechanism, make sure to add the following assemblies to your project’s distribution:
- Logify.Alert.Core.dll
- Logify.Alert.Web.dll
Integration with Logging Tools
Logify can automatically record crash reports in your project’s centralized log when using the following logging services:
|
|