13

I am using NLog for logging in my asp.net 4.5 website. I have used NLog 4.0. Now I need to use session variables in my logs. So i tries to use AspNetSession layout renderer. This layout renderer is included in Nlog.Web. I have added this dll and also under the extensions tag in NLog config file. But it gives the following error:

ArgumentException: LayoutRenderer cannot be found: 'aspnet-session'

I have also added NLog.extended dll and also under the extensions tag in NLog config file. But it also didn't help.

Please let me know what should i do.

enter image description here

S.Krishna
  • 858
  • 10
  • 25
Deeps
  • 517
  • 9
  • 30
  • 2
    This is discussed at Github. (https://github.com/NLog/NLog/issues/767) This was an issue in the auto-load feature (fixed in 4.0.1). Also the `` won't work here due to the unneeded / incorrect `assemblyFile` attribute. – Julian Jul 02 '15 at 19:29
  • I just saw the issue you linked, I'm using asp net 5 and after installing the `NLog.Web` package I still get the `Layout renderer not for aspnet-user-identity` and the same happens for all other `aspnet-`s and the `iis-site-name` as well. I'm registering things programmatically, is there a special way to load `NLog.Web` to make it work do I have to register it somewhere else? Thanks in advance – Luiso Dec 14 '15 at 19:07

1 Answers1

18

You need to install NLog.Web assembly from NuGet by using the following command.

Install-Package NLog.Web
Ryan Gates
  • 4,352
  • 4
  • 46
  • 84