An Interest In:
Web News this Week
- April 18, 2024
- April 17, 2024
- April 16, 2024
- April 15, 2024
- April 14, 2024
- April 13, 2024
- April 12, 2024
October 16, 2021 01:33 pm GMT
Original Link: https://dev.to/mustafasamedyeyin/aspnet-core-handle-errors-dosyaya-errors-loglamak-giris-3fd1
Asp.net core Handle Errors; Dosyaya Errors Loglamak Giri.
lk bata aadaki yazmdaki admlar teker teker uygulayalm :
https://dev.to/mustafasamedyeyin/asp-net-core-logging-serilog-giris-200d
Daha sonra HomeController'nn Index action'n aadaki gibi deitirelim :
public IActionResult Index() { throw new Exception(Environment.NewLine + Environment.NewLine + Environment.NewLine + "Bu ylesine frlatlm hata;"); return View(); }
Daha sonra Error action'nn iini aadaki gibi deitirelim :
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] public IActionResult Error() { var exHandlerFeature = HttpContext.Features.Get<IExceptionHandlerFeature>(); var exception = exHandlerFeature.Error; Log.Error(exception,"Bir hata olutu."); return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier }); }
Uygulamay altrdnzda belirttiiniz yolda aadaki dosyalar ve loglar oluacaktr :
Aadaki linkteki her eyi yaptysanz seq'de de loglarn grebilirsiniz.
https://dev.to/mustafasamedyeyin/asp-net-core-logging-serilog-giris-200d
Bir dahaki yazmda grmek dileiyle.
En iyi dileklerim ile.
Mustafa Samed Yeyin.
Original Link: https://dev.to/mustafasamedyeyin/aspnet-core-handle-errors-dosyaya-errors-loglamak-giris-3fd1
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To