Ticket T913939
Visible to All Users

Enable logging in XAF Blazor

created 5 years ago

Hello!

For testing with XAF Blazor I need to see the XPO queries generated in the VS debug output window (I need to know which query caused an exception). In appsettings.json I changed general LogLevel (Default) to "Trace" but I still don't see any log outputs from XAF or XPO.
Can you please tell me how I can enable verbose logging for XAF Blazor?

Thanks,
Johannes

Comments (1)
DevExpress Support Team 5 years ago

    Hello Johannes,

    Thank you for contacting us. We need additional time to answer your question. Please bear with us. We will get back to you as soon as possible.

    Answers approved by DevExpress Support

    created 5 years ago (modified 3 years ago)

    Hello Johannes,

    Thank you for your patience.

    The LogLevel section in the appsettings.json file does not affect the .NET Framework tracing mechanism. It is intended to configure .NET Core logging providers (Logging in .NET Core and ASP.NET Core). At the moment, XPO uses only the .NET Framework tracing mechanism. That is why your settings do not affect XPO behavior.

    We will take this requirement into account for future improvements. Currently, consider the following approaches of finding which SQL query caused an exception:

    1. Setup Visual Studio to catch user handled exceptions. Refer to the following help topic for details: Collect and Analyze the Diagnostic Information. If the exception occurs when XPO executes a SQL query, the Call Stack window should contain SelectData or ModifyData method calls. Double click such a line and look at the Locals window. Arguments should include query details.
    2. Use XPO Profiler to gather and analyze XPO logs.
    3. Implement a custom XPO logger, as described at How to Log SQL Queries

    XPO profiler supports multiple approaches to connect to an XPO-based application. The following articles describe methods compatible with .NET Core apps:
    Connect the XPO Profiler to an ASP.NET Core Application
    Connect the XPO Profiler to an Application via Named Pipes

    To include exception stack traces into SQL logs, set the static DevExpress.Xpo.Logger.LogManager.IncludeStackTrace property to true.

    As for the XAF tracing mechanism, you can set its verbosity level in the appsettings.json file using the "Default" or "DevExpress.ExpressApp" category. However, XAF Blazor supports this feature in the latest builds only.

    Please let me know if you have additional questions. I will be happy to help you.

      Comments (2)

        Thank you for the comprehensive answer, Uriah. Good to hear that XAF Blazor is now supporting .NET Core logging. Of course it would be helpful if also XPO queries could be sent to the debug output in future version. I use(d) that output a lot in regular/old .Net. For now I was able to pinpoint the recent problem (exception) in the debugger with DX PDP files.

        DevExpress Support Team 5 years ago

          You are welcome, Johannes!

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.