The LogLevel section in the appsettings.json file does not affect the .NET Framework tracing mechanism, which is used by XPO to log the queries, still we have a few work arounds for a Netcore app
- We can implement our own logger as shown here https://docs.devexpress.com/XPO/403928/best-practices/how-to-log-sql-queries#xpo-logger-net
- We can set the value of the logging switch by reflection using the following snippet
private static void EnableXpoDebugLog() { FieldInfo xpoSwitchF = typeof(ConnectionProviderSql).GetField("xpoSwitch", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic); TraceSwitch xpoSwitch = (TraceSwitch)xpoSwitchF.GetValue(null); xpoSwitch.Level = TraceLevel.Info; }
I actually use the second work around in my own projects.
If you want to learn more about the logging mechanism of XPO you can take a look to the following articles
https://supportcenter.devexpress.com/ticket/details/t913939/enable-logging-in-xaf-blazor