Visual Studio 2019 中的默认 API 示例实例化一个ILogger<T>
. 如果我通过_logger.Log(LogLevel.Information, "hello")
如何查看日志文件来调用它?此问题假定使用 Azure 应用服务。
namespace WebApplication1.Controllers
{
[ApiController]
[Route("[controller]")]
public class WeatherForecastController : ControllerBase
{
private static readonly string[] Summaries = new[]
{
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
};
private readonly ILogger<WeatherForecastController> _logger;
public WeatherForecastController(ILogger<WeatherForecastController> logger)
{
_logger = logger;
}
}
}