I've got a basic ASP.NET webapp that uses log4net to keep track of certain key actions. When I'm running the app on my workstation, the log entries include my username:
[2012-08-15 18:05:17,838] - MoneyApp.Import - LocalAD\ivravenger - Attempting File Import From C:\fakepath\outputFile.txt
However, when I run the app on a server, I get the ASP.NET worker process as the user ID:
[2012-08-15 18:05:17,838] - MoneyApp.Import - IIS APPPOOL\ASP.NET v4.0 32-bit - Attempting File Import From C:\fakepath\outputFile.txt
Here's my config string:
<conversionPattern value="[%date] - %logger - %username - %message%newline" />
How do I go about getting the web user ID into the log file? I'm already retrieving the user ID within the codebehind on each page, I'm just not sure the best way to get it into the log text without having to append it to each log() statement.