using System.Diagnostics; Trace.TraceInformation("This is an information log");
using Microsoft.Extensions.Logging; ILoggerFactory factory = LoggerFactory.Create(builder => { builder.AddConsole(); // Adds a console logger builder.AddDebug(); // Adds a debug logger }); ILogger logger = factory.CreateLogger("application"); logger.LogInformation("This is an information log");In this example, the ILoggerFactory and ILogger classes are used from the Microsoft.Extensions.Logging package to create a logger factory and add an information log to the log file. The package library used in both examples is the .NET Framework/Core.