sorryb / Northwind

Northwind Web Shop Application with MVC 5 and EF 6. (branch ASP.NET Core 1.0)
3 stars 3 forks source link

Adaugare erori in EventView-er folosind log4Net #67

Closed sorryb closed 7 years ago

sorryb commented 7 years ago

Am configurat aplicatia sa logheze erorile in Event View-er (in cmd rulati eventvwr) unde le vedeti in NorthwindLog in' Application and Services Log'.

In controller trebuie sa adaugati un singur try-catch(vezi HomeController) in fiecare metoda astfel 👍 private log4net.ILog logger = log4net.LogManager.GetLogger(typeof(HomeController));
public ActionResult ...() { try { ... ...

            return ...
        }
        catch (Exception exception)
        {
            logger.Error(exception.ToString());
            return View();
        }
    }
nchmona commented 7 years ago

in account trebuie adaugat logger