A user (whether live or internal) allegedly has an issue with your ASP.NET web site that stores the user Id in the ASP.NET session. They describe the problem and the steps to reproduce, but even with that it would be nice to have more information about what specifically they did. Or better yet what the code did on their behalf.
For this, it helps to have more granular data than tracking. We will wade through the pile of application logs to find our smoking gun. If you’re using NLog odds are that you already have this.
Now there is a different problem, the sheer volume of log statements. Even for a relatively small site (~50 concurrent users) plucking out the relevant statements for your problem user becomes a problem.
Simply add the userid or any other session variable to each log statement and then you can easily filter based on that. Wait a second though…I don’t want to have to edit each and every log statement. Fortunately thanks to NLog you don’t have to.
NLog.Config will stand up a shell configuration file with examples.
NLog.Web will add the ability to use ASP.NET session variables and other goodies with NLog.
Update the NLog.Config file like below to include the new value.
There you have it. Now you can easily filter log entries by user. You can find my code here.
- AspNetSession layout renderer
- NLog Database target
- AspNetSession layout renderer not working
- NLogUserIdToDB code