Problem with NLog Resolved

Discussion in 'ASP.NET / ASP.NET Core' started by ilennert, Jan 25, 2011.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. I was having a problem using NLog to log information to the web site file system for my later viewing. I was not having any trouble with it on my local machine.

    I was using NInject IOC container to manage it's instantiation as per a Rob Conery video. Though eveything else has been spot on!

    The web app was crashing with a null reference exception when starting. I though it was having a problem writing the information to the file, which I though was some sort of a permissions problem on the DiscountASP server but, that was not the case.

    What I found was Don't use your IOC container! There is a static class that manages it, and does so very well.

    The code that now works in both place looks like this:

    var logger = NLog.LogManager.GetCurrentClassLogger();
    logger.Info("Application Started");
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page