DOCUMENTATION
Send Reports
Logify Alert provides you with two main approaches used to send reports. You can command Logify Alert to automatically listen to uncaught exceptions and deliver crash reports (automatic reporting). As an alternative, you can catch exceptions (for example, using try ... catch blocks), and command Logify Alert to generate reports based on caught exceptions and send these reports only (manual reporting).
Note: Before sending reports to the Logify Alert service, your application must be registered using the API Key generated for it. For detailed instructions, refer to the Create Application document.
To determine how to send reports from your application, select the application type from the list below.
ASP.NET WebForms and MVC
Execute the command below in the Package Manager Console.
Install-Package Logify.Alert.Web
Add the Logify Alert settings to the application's Web.config file. To initialize your application, use the API Key generated for it.
<configuration>
<configSections>
...
<section name="logifyAlert" type="DevExpress.Logify.WebLogifyConfigSection, Logify.Alert.Web"/>
...
</configSections>
...
<logifyAlert>
<apiKey value="SPECIFY_YOUR_API_KEY_HERE"/>
<customData>
<add key="SOME_KEY" value="SOME_ADDITIONAL_INFO" />
...
<customData/>
</logifyAlert>
</configuration>
Add the Logify.Alert.Web module to the Modules section.
<system.webServer>
<modules>
...
<add name="Logify.Alert.Web" type="DevExpress.Logify.Web.AspExceptionHandler, Logify.Alert.Web" preCondition="managedHandler"/>
...
</modules>
</system.webServer>
Rebuild your application.
Execute the command below in the Package Manager Console.
Install-Package Logify.Alert.Web
Add the following code to your application's code. To initialize your application, use the API Key generated for it.
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 the application.
ASP.NET WebApi
Execute the command below in the Package Manager Console.
Install-Package Logify.Alert.Web
Add the Logify Alert settings to the application's Web.config file. To initialize your application, use the API Key generated for it.
<configuration>
<configSections>
...
<section name="logifyAlert" type="DevExpress.Logify.WebLogifyConfigSection, Logify.Alert.Web"/>
...
</configSections>
...
<logifyAlert>
<apiKey value="SPECIFY_YOUR_API_KEY_HERE"/>
<customData>
<add key="SOME_KEY" value="SOME_ADDITIONAL_INFO" />
...
<customData/>
</logifyAlert>
</configuration>
Add the Logify.Alert.Web module to the Modules section.
<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());
}
}
Rebuild your application.
Execute the command below in the Package Manager Console.
Install-Package Logify.Alert.Web
Add the following code to your application's code. To initialize your application, use the API Key generated for it.
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 the application.
WinForms
Execute the command below in the Package Manager Console.
Install-Package Logify.Alert.Win
Add the following code to your application's code. To initialize your application, use the API Key generated for it.
using DevExpress.Logify.Win;
LogifyAlert client = LogifyAlert.Instance;
client.ApiKey = "SPECIFY_YOUR_API_KEY_HERE";
client.StartExceptionsHandling();
Rebuild the application.
Execute the command below in the Package Manager Console.
Install-Package Logify.Alert.Win
Add the following code to your application's code. To initialize your application, use the API Key generated for it.
using DevExpress.Logify.Win;
try {
// Some code
}
catch (Exception ex) {
LogifyAlert client = LogifyAlert.Instance;
client.ApiKey = "SPECIFY_YOUR_API_KEY_HERE";
client.Send(ex);
}
Rebuild the application.
WPF
Execute the command below in the Package Manager Console.
Install-Package Logify.Alert.Wpf
Add the following code to your application's code. To initialize your application, use the API Key generated for it.
using DevExpress.Logify.WPF;
LogifyAlert client = LogifyAlert.Instance;
client.ApiKey = "SPECIFY_YOUR_API_KEY_HERE";
client.StartExceptionsHandling();
Rebuild the application.
Execute the command below in the Package Manager Console.
Install-Package Logify.Alert.Wpf
Add the following code to your application's code. To initialize your application, use the API Key generated for it.
using DevExpress.Logify.WPF;
try {
// Some code
}
catch (Exception ex){
LogifyAlert client = LogifyAlert.Instance;
client.ApiKey = "SPECIFY_YOUR_API_KEY_HERE";
client.Send(ex);
}
Rebuild the application.
Console
Execute the command below in the Package Manager Console.
Install-Package Logify.Alert.Console
Add the following code to your application's code. To initialize your application, use the API Key generated for it.
using DevExpress.Logify.Console;
LogifyAlert client = LogifyAlert.Instance;
client.ApiKey = "SPECIFY_YOUR_API_KEY_HERE";
client.StartExceptionsHandling();
Rebuild the application.
Execute the command below in the Package Manager Console.
Install-Package Logify.Alert.Console
Add the following code to your application's code. To initialize your application, use the API Key generated for it.
using DevExpress.Logify.Console;
try {
// Some code
}
catch (Exception ex) {
LogifyAlert client = LogifyAlert.Instance;
client.ApiKey = "SPECIFY_YOUR_API_KEY_HERE";
client.Send(ex);
}
Rebuild the application.
JavaScript (JS)
Add the following code to your application's code. To initialize your application, use the API Key generated for it.
<script type="text/javascript" src="https://logifyjs.devexpress.com/logifyAlert.min.js"></script>
<script type="text/javascript">
var logify = new logifyAlert("SPECIFY_YOUR_API_KEY_HERE");
logify.startHandling();
</script>
Run the application.
Add the following code to your application's code. To initialize your application, use the API Key generated for it.
<script type="text/javascript" src="https://logifyjs.devexpress.com/logifyAlert.min.js"></script>
<script type="text/javascript">
// Sends exception
window.onerror = function myErrorHandler(errorMsg, url, lineNumber, column, errorObj) {
LogifyAlert client = new LogifyAlert("SPECIFY_YOUR_API_KEY_HERE");
client.sendException(errorMsg, url, lineNumber, column, errorObj);
return true;
}
// Sends rejection
window.addEventListener('unhandledrejection', event => {
LogifyAlert client = new logifyAlert("SPECIFY_YOUR_API_KEY_HERE");
client.sendRejection(event.reason, event.promise);
});
</script>
Run the application.
Node.js
Execute the following command.
npm install logify-alert --save
Add the code below anywhere to your JavaScript file. To initialize your application, use the API Key generated for it.
var logifyAlert = require('logify-alert');
var client = new logifyAlert('SPECIFY_YOUR_API_KEY_HERE');
client.startHandling();
Run the application.
Execute the following command.
npm install logify-alert --save
Add the code below anywhere to your JavaScript file. To initialize your application, use the API Key generated for it.
// Sends exception
var logifyAlert = require('logify-alert');
process.on('uncaughtException', (error) => {
var client = new logifyAlert('SPECIFY_YOUR_API_KEY_HERE');
client.sendException(error);
});
// Sends rejection
process.on('unhandledRejection', (reason, promise) => {
var client = new logifyAlert('SPECIFY_YOUR_API_KEY_HERE');
client.sendRejection(reason);
});
Run the application.
|
|