The Rock Solid Knowlegde SAML component uses the standard logging mechanisms provided by ASP.NET Core.
If you are new to logging in ASP.NET Core, we recommend reading the Microsoft documentation, which explains the different built-in logging providers and how to configure and integrate them into your application.
Log Levels
We use the standard log levels in ASP.NET Core: Trace
, Debug
, Information
, Warning
, Error
and Critical
.
Generally, the Information
level can assist you with troubleshooting development issues.
We recommend using the Warning
level in production to avoid leaking sensitive data and producing too much logging data, which can impact the performance of your application.
Example Logger Setup
Here's an example of using Serilog in your application. However, any ASP.NET Core logging providers may be used to capture logging information.
public class Program
{
public static void Main(string[] args)
{
Log.Logger = new LoggerConfiguration()
// default minimum level
.MinimumLevel.Debug()
// override the minimum level for events from a specific namespace
.MinimumLevel.Override("Microsoft", LogEventLevel.Warning)
.MinimumLevel.Override("System", LogEventLevel.Warning)
.Enrich.FromLogContext()
.WriteTo.Console(outputTemplate: "[{Timestamp:HH:mm:ss} {Level}] {SourceContext}{NewLine}{Message:lj}{NewLine}{Exception}{NewLine}", theme: AnsiConsoleTheme.Code)
.CreateLogger();
Log.Information("Starting up");
CreateHostBuilder(args).Build().Run();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Microsoft.Extensions.Hosting.Host.CreateDefaultBuilder(args)
.UseSerilog()
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});
}