Current filter:
                                You should refresh the page.
                                Support Center
                                0
                                  • Hi,
                                    As a XAF developer, it would be nice to have tsome guidelines to replace XAF exception handling with logify

                                    Thanks

                                    Gustavo

                                1 Solution

                                Creation Date Rating Importance Sort by
                                0

                                Hello Gustavo,

                                You can learn more on the XAF default exception handling mechanism and its extensibility points from the Concepts > Debugging and Error Handling article and related ones.
                                Here, you will find the documentation on the Logify-specific integration code: WinFormsASP.NET. Should you experience any questions on these Logify APIs or the https://logify.devexpress.com/ service itself, please contact the corresponding team directly using the https://www.devexpress.com/ask service (specify the Logify category).

                                 

                                Starting with version 17.1.4, the easiest of integrating Logify in XAF apps is using the LogifyAlertTraceListener API. Below you will find common and platform-dependent integration instructions for this currently recommended approach. Take special note that other Logify integration options are still valid and suitable (see below). Choose the most appropriate method depending on your business needs.

                                 

                                Common

                                First, for desktop, web and even mobile XAF apps, it is required to generate the API Key and make modifications in the application configuration file to register a new configuration section where you can specify the API key generated previously. 
                                Second, it is required to register the appropriate trace listener that will handle errors that were previously simply added to the log file by the DevExpress.Persistent.Base.Tracing.Tracer.LogError or System.Diagnostics.Trace.TraceError methods.
                                Third, install the appropriate platform-specific Logify packages or libraries from Nuget into your app.


                                ASP.NET WebForms/Mobile:

                                1. Install the Web-specific Logify package: 

                                1.1. Select Tools | NuGet Package Manager | Package Manager Console from the Visual Studio main menu;

                                1.2. Execute the  Install-Package Logify.Alert.Web command

                                 

                                2. In the web.config file, register the new configuration section and specify the API key, as follows:

                                [XML]
                                <configuration> <configSections> <section name="logifyAlert" type="DevExpress.Logify.WebLogifyConfigSection, Logify.Alert.Web"/> </configSections> <logifyAlert> <apiKey value="SPECIFY_YOUR_API_KEY_HERE"/> </logifyAlert> </configuration>

                                 3. Register the DevExpress.Logify.Web.LogifyAlertTraceListener trace listener:

                                [XML]
                                <system.diagnostics> <trace autoflush="false" indentsize="4"> <listeners> <add name="LogifyAlertTraceListener" type="DevExpress.Logify.Web.LogifyAlertTraceListener, Logify.Alert.Web" /> </listeners> </trace> </system.diagnostics>

                                 


                                WinForms
                                1. Install the WinForms-specific Logify package: 

                                1.1. Select Tools | NuGet Package Manager | Package ManagerConsole from the Visual Studio main menu;

                                1.2. Execute the  Install-Package Logify.Alert.Win command


                                2. In the app.config file, register the new configuration section  and specify the API key, as follows:

                                [XML]
                                <configuration> <configSections> <section name="logifyAlert" type="DevExpress.Logify.LogifyConfigSection, Logify.Alert.Win"/> </configSections> <logifyAlert> <apiKey value="SPECIFY_YOUR_API_KEY_HERE" /> </logifyAlert> </configuration>

                                3. Register the DevExpress.Logify.Win.LogifyAlertTraceListener trace listener :

                                [XML]
                                <system.diagnostics> <trace autoflush="false" indentsize="4"> <listeners> <add name="LogifyAlertTraceListener" type="DevExpress.Logify.Win.LogifyAlertTraceListener, Logify.Alert.Win" /> </listeners> </trace> </system.diagnostics>

                                 

                                 

                                Alternative XAF integration options

                                Take special note that other Logify integration options are still valid and suitable (choose the most appropriate method depending on your business needs):

                                1. Create a custom Tracing class and override its LogError and other LogXXX methods to call the Logify-specific integration code. The Concepts > Debugging and Error Handling > Add Custom Log Entries and Customize the Default Tracer Behavior  article describes the XAF part in detail. 

                                OR

                                2. Disable the XAF logging mechanism in the application configuration file (<add name="eXpressAppFramework" value="0" />) and insert the Logify integration code into the following places in your XAF app.

                                2.1. WinForms (YourSolutionName.Win/Program.xx):

                                [C#]
                                ... try { winApplication.Setup(); winApplication.Start(); } catch(Exception exception) { //Insert your Logify exception logging code here. //DevExpress.Logify.Win.LogifyAlert.Instance.Send(exception); winApplication.HandleException(exception); } ...

                                 2.2. ASP.NET WebForms (YourSolutionName.Web/Global.asax.xx):

                                [C#]
                                ... protected void Application_Error(object sender, EventArgs e) { if(HttpContext.Current != null) { Exception exception = HttpContext.Current.Server.GetLastError(); //Insert your Logify exception logging code here. //DevExpress.Logify.Web.LogifyAlert.Instance.Send(exception); } ErrorHandling.Instance.ProcessApplicationError(); } ...

                                You will be interested to know that we are using this approach in our online Web and Mobile demos available at https://www.devexpress.com/Products/NET/Application_Framework/demos.xml
                                Logify itself is also widely used inside our company to deliver crash reports in other demos, runtime and design time tools across many products and technologies. Refer to the screenshot below for more details:

                                Show all comments
                                • Gustavo Marzioni 01.19.2017
                                  sure Dennis, make it public!
                                • Thanks, published.
                                • in the simplest case do this:

                                  winapplication:
                                  protected override void HandleExceptionCore(Exception e) {     
                                  base.HandleExceptionCore(e);     
                                  LogifyAlert.Instance.Send(e); }
                                • Thanks for your update, Noxe. I have mentioned this option as well.
                                • Taradanov 01.20.2017
                                  I hope there will be some built-in way to easily use Logify in the future.
                                • @Taradanov: Would you please describe what you find difficult about these approaches and, preferably, describe how you would like to get this integration task done instead? Thanks in advance.

                                • Michael Gibson - PatTrac 03.02.2017
                                  are you saying to change

                                  [C#]
                                  <system.diagnostics> <switches> <!-- Use the one of predefined values: 0-Off, 1-Errors, 2-Warnings, 3-Info, 4-Verbose. The default value is 3. --> <add name="eXpressAppFramework" value="3" /> </switches> </system.diagnostics>
                                  the value to 0? or 4?
                                • @Michael: Thanks for finding a typo. Yes, I meant 0 in point #2.

                                If you need additional product information, write to us at info@devexpress.com or call us at +1 (818) 844-3383

                                FOLLOW US

                                DevExpress engineers feature-complete Presentation Controls, IDE Productivity Tools, Business Application Frameworks, and Reporting Systems for Visual Studio, along with high-performance HTML JS Mobile Frameworks for developers targeting iOS, Android and Windows Phone. Whether using WPF, ASP.NET, WinForms, HTML5 or Windows 10, DevExpress tools help you build and deliver your best in the shortest time possible.

                                Copyright © 1998-2017 Developer Express Inc.
                                All trademarks or registered trademarks are property of their respective owners