生産と開発環境のためのasp.netコア2.0プロジェクトのコンソールログに日付と時刻を記述する方法はありますか?コンソールログの日付と時刻
私は、起動中に次き:
services.AddLogging(builder =>
{
builder.AddConfiguration(Configuration.GetSection("Logging"+Environment.EnvironmentName))
.AddConsole()
.AddDebug();
});
Appsettings.json:(ログ行の日付や時刻なし)
"LoggingDevelopment": {
"IncludeScopes": false,
"Console": {
"LogLevel": {
"Default": "Debug",
"System": "Information",
"Microsoft": "Information"
}
}
},
"LoggingProduction": {
"IncludeScopes": false,
"Console": {
"LogLevel": {
"Default": "Error",
"System": "Error",
"Microsoft": "Error"
}
}
},
現在の[開発]ログレイアウト:
info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[2]
Executed action a.Controller (project) in 531.2457ms
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
Request finished in 532.5812ms 200 text/html; charset=utf-8
エラーラインのための生産モードでは、日付と時刻が非常に便利です。
この有用かもしれません:https://github.com/aspnet/Logging/issues/483。 –