سؤال

Is there a way blog can capture all exception without specifying a try catch? For example going to a page that is not available on a MVC website and picking up an error in Icontroller and capturing page not found. ?

هل كانت مفيدة؟

المحلول

NLog does not capture errors in your application. It allows you to log captured errors.

See Exception Handling in ASP.NET MVC or Global Error Handling in ASP.NET MVC to understand how you can capture errors. After exception is captured, you can log it with:

Logger.ErrorException(message, exception);
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top