Plugin for log4net
Logify Alert provides you with a plugin that allows integrating Logify reports with log4net logs.
Install the Plugin
To add the plugin to the application's code, follow the steps below.
-
Select Tools | NuGet Package Manager | Package Manager Console from the Visual Studio main menu.
-
Execute the command below.
Install-Package Logify.Alert.Log4Net
-
Execute the command below.
WinForms applications: Install-Package Logify.Alert.Win
Web applications: Install-Package Logify.Alert.Web
WPF applications: Install-Package Logify.Alert.Wpf
Console applications: Install-Package Logify.Alert.Console
Set Up the Plugin
Set up the plugin according to your target platform. The App.config example below demonstrates how to set up the plugin for a WinForms application.
<configuration>
<configSections>
<section name="logifyAlert" type="DevExpress.Logify.LogifyConfigSection, Logify.Alert.Win" />
</configSections>
<logifyAlert>
<apiKey value="SPECIFY_YOUR_API_KEY_HERE" />
<confirmSend value="false" />
<customData>
<add key="MACHINE_NAME" value="My Server" />
</customData>
</logifyAlert>
</configuration>
Register an Appender
Register the LogifyAlertAppender as a standard log4net appender either in the application's App.config/Web.config or a special log4net.config configuration file as follows.
<log4net>
<root>
<level value="ALL" />
<appender-ref ref="LogifyAlertAppender" />
</root>
<appender name="LogifyAlertAppender" type="DevExpress.Logify.Alert.Log4Net.LogifyAppender, Logify.Alert.Log4Net">
</appender>
</log4net>
Initialize the Client
Add the following code to your application's code. The example below demonstrates how to set up the plugin for a WinForms application.
using DevExpress.Logify.Win;
LogifyAlert client = LogifyAlert.Instance;
Now, each time your application calls the ILog.Error log4Net method with non-empty LoggingEvent.ExceptionObject parameter, a new report is generated and sent to Logify Alert. For example:
log.Error("Test message", new Exception("Test Logify exception"));
Ready Solutions
The list below consists of articles that demonstrate ready scenarios for the feature.