- Популярные видео
- Авто
- Видео-блоги
- ДТП, аварии
- Для маленьких
- Еда, напитки
- Животные
- Закон и право
- Знаменитости
- Игры
- Искусство
- Комедии
- Красота, мода
- Кулинария, рецепты
- Люди
- Мото
- Музыка
- Мультфильмы
- Наука, технологии
- Новости
- Образование
- Политика
- Праздники
- Приколы
- Природа
- Происшествия
- Путешествия
- Развлечения
- Ржач
- Семья
- Сериалы
- Спорт
- Стиль жизни
- ТВ передачи
- Танцы
- Технологии
- Товары
- Ужасы
- Фильмы
- Шоу-бизнес
- Юмор
ASP NET Core LogLevel configuration
In this video we will discuss the significance of LogLevel configuration in ASP.NET Core.
Text version of the video
https://csharp-video-tutorials.blogspot.com/2019/05/aspnet-core-loglevel-configuration.html
Healthy diet is very important for both body and mind. We want to inspire you to cook and eat healthy. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking.
https://www.youtube.com/channel/UC7sEwIXM_YfAMyonQCrGfWA/?sub_confirmation=1
Slides
https://csharp-video-tutorials.blogspot.com/2019/05/aspnet-core-loglevel-configuration_31.html
ASP.NET Core Text Articles & Slides
https://csharp-video-tutorials.blogspot.com/2019/01/aspnet-core-tutorial-for-beginners.html
ASP.NET Core Tutorial
https://www.youtube.com/playlist?list=PL6n9fhu94yhVkdrusLaQsfERmL_Jh4XmU
Angular, JavaScript, jQuery, Dot Net & SQL Playlists
https://www.youtube.com/user/kudvenkat/playlists?view=1&sort=dd
LogLevel indicates the severity of the logged message. It can be any of the following. They are listed here from lowest to highest severity.
Trace = 0
Debug = 1
Information = 2
Warning = 3
Error = 4
Critical = 5
None = 6
LogLevel Enum
LogLevel enum is present in Microsoft.Extensions.Logging namespace
namespace Microsoft.Extensions.Logging
{
public enum LogLevel
{
Trace = 0,
Debug = 1,
Information = 2,
Warning = 3,
Error = 4,
Critical = 5,
None = 6
}
}
LogLevel in appsettings.json
LogLevel setting in appsettings.json file is used to control how much log data is logged or displayed.
"Logging": {
"LogLevel": {
"Default": "Trace",
"Microsoft": "Warning"
}
}
ILogger Methods
On the ILogger interface, we have log methods that include the log level in the method name. For example to log a TRACE message we use LogTrace() method. Similarly to log a WARNING message we use LogWarning() method. Notice, except for LogLevel = None, we have a corresponding method for every log level.
LogTrace()
LogDebug()
LogInformation()
LogWarning()
LogError()
LogCritical()
LogLevel Example
Consider the following Details() action in HomeController
public class HomeController : Controller
{
public ViewResult Details(int? id)
{
logger.LogTrace("Trace Log");
logger.LogDebug("Debug Log");
logger.LogInformation("Information Log");
logger.LogWarning("Warning Log");
logger.LogError("Error Log");
logger.LogCritical("Critical Log");
// Rest of the code
}
}
The following is the LogLevl configuration in appsettings.json file.
"Logging": {
"LogLevel": {
"Default": "Trace",
"Microsoft": "Warning"
}
}
The following Log output is displayed in the Debug Output window. Since we have set "Default": "Trace", we see everything from Trace level and higher. Since Trace is the lowest level we see all the logs.
EmployeeManagement.Controllers.HomeController:Trace: Trace Log
EmployeeManagement.Controllers.HomeController:Debug: Debug Log
EmployeeManagement.Controllers.HomeController:Information: Information Log
EmployeeManagement.Controllers.HomeController:Warning: Warning Log
EmployeeManagement.Controllers.HomeController:Error: Error Log
EmployeeManagement.Controllers.HomeController:Critical: Critical Log
However if you want WARNING and higher then set "Default": "Warning"
If you do not want anything logged set LogLevel to None. The integer value of LogLevel.None is 6, which is higher than all the other log levels. So nothing gets logged.
Log filtering in ASP.NET Core
Consider the following log statement
EmployeeManagement.Controllers.HomeController:Trace: My log message
EmployeeManagement.Controllers.HomeController is the LOG CATEGORY
Trace is the LOG LEVEL. Remeber log level can be (Trace, Debug, Information, etc...)
In simple terms, LOG CATEGORY is the fully qualified name of the class that logged the message. The log category is displayed as a string in the logged message so we can use it easily determine from which class the log came from. LOG CATEGORY is used to filter logs.
Видео ASP NET Core LogLevel configuration канала kudvenkat
Text version of the video
https://csharp-video-tutorials.blogspot.com/2019/05/aspnet-core-loglevel-configuration.html
Healthy diet is very important for both body and mind. We want to inspire you to cook and eat healthy. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking.
https://www.youtube.com/channel/UC7sEwIXM_YfAMyonQCrGfWA/?sub_confirmation=1
Slides
https://csharp-video-tutorials.blogspot.com/2019/05/aspnet-core-loglevel-configuration_31.html
ASP.NET Core Text Articles & Slides
https://csharp-video-tutorials.blogspot.com/2019/01/aspnet-core-tutorial-for-beginners.html
ASP.NET Core Tutorial
https://www.youtube.com/playlist?list=PL6n9fhu94yhVkdrusLaQsfERmL_Jh4XmU
Angular, JavaScript, jQuery, Dot Net & SQL Playlists
https://www.youtube.com/user/kudvenkat/playlists?view=1&sort=dd
LogLevel indicates the severity of the logged message. It can be any of the following. They are listed here from lowest to highest severity.
Trace = 0
Debug = 1
Information = 2
Warning = 3
Error = 4
Critical = 5
None = 6
LogLevel Enum
LogLevel enum is present in Microsoft.Extensions.Logging namespace
namespace Microsoft.Extensions.Logging
{
public enum LogLevel
{
Trace = 0,
Debug = 1,
Information = 2,
Warning = 3,
Error = 4,
Critical = 5,
None = 6
}
}
LogLevel in appsettings.json
LogLevel setting in appsettings.json file is used to control how much log data is logged or displayed.
"Logging": {
"LogLevel": {
"Default": "Trace",
"Microsoft": "Warning"
}
}
ILogger Methods
On the ILogger interface, we have log methods that include the log level in the method name. For example to log a TRACE message we use LogTrace() method. Similarly to log a WARNING message we use LogWarning() method. Notice, except for LogLevel = None, we have a corresponding method for every log level.
LogTrace()
LogDebug()
LogInformation()
LogWarning()
LogError()
LogCritical()
LogLevel Example
Consider the following Details() action in HomeController
public class HomeController : Controller
{
public ViewResult Details(int? id)
{
logger.LogTrace("Trace Log");
logger.LogDebug("Debug Log");
logger.LogInformation("Information Log");
logger.LogWarning("Warning Log");
logger.LogError("Error Log");
logger.LogCritical("Critical Log");
// Rest of the code
}
}
The following is the LogLevl configuration in appsettings.json file.
"Logging": {
"LogLevel": {
"Default": "Trace",
"Microsoft": "Warning"
}
}
The following Log output is displayed in the Debug Output window. Since we have set "Default": "Trace", we see everything from Trace level and higher. Since Trace is the lowest level we see all the logs.
EmployeeManagement.Controllers.HomeController:Trace: Trace Log
EmployeeManagement.Controllers.HomeController:Debug: Debug Log
EmployeeManagement.Controllers.HomeController:Information: Information Log
EmployeeManagement.Controllers.HomeController:Warning: Warning Log
EmployeeManagement.Controllers.HomeController:Error: Error Log
EmployeeManagement.Controllers.HomeController:Critical: Critical Log
However if you want WARNING and higher then set "Default": "Warning"
If you do not want anything logged set LogLevel to None. The integer value of LogLevel.None is 6, which is higher than all the other log levels. So nothing gets logged.
Log filtering in ASP.NET Core
Consider the following log statement
EmployeeManagement.Controllers.HomeController:Trace: My log message
EmployeeManagement.Controllers.HomeController is the LOG CATEGORY
Trace is the LOG LEVEL. Remeber log level can be (Trace, Debug, Information, etc...)
In simple terms, LOG CATEGORY is the fully qualified name of the class that logged the message. The log category is displayed as a string in the logged message so we can use it easily determine from which class the log came from. LOG CATEGORY is used to filter logs.
Видео ASP NET Core LogLevel configuration канала kudvenkat
asp.net core loglevel appsettings.json asp.net core loglevel configuration asp.net core change log level asp.net core console log level asp.net core log level example asp.net core logging log level asp.net core logging loglevel asp.net core loglevel not working asp.net core set log level asp.net core logging level tutorial asp.net core disable console logging asp.net core disable microsoft logging asp.net core disable default logging
Комментарии отсутствуют
Информация о видео
1 июня 2019 г. 0:25:29
00:15:45
Другие видео канала









