Logging Errors and Warnings
Avalonia can log warnings and errors using System.Diagnostics.Trace
. To enable logging the LogToTrace
method call should be present in your Program.cs file:
public static AppBuilder BuildAvaloniaApp()
=> AppBuilder.Configure<App>()
.UsePlatformDetect()
.LogToTrace();
By default, this logging setup will write log messages with a severity of Warning
or higher to System.Diagnostics.Trace
. The severity can be controlled by passing a level
parameter to LogToTrace()
.
By default these trace messages would be logger to your IDE output window. If you want to re-route these messages to different location, use API provided by System.Diagnostics.Trace
.