Add UserID to the logged information (Database)

Topics: Logging Application Block
Jan 14, 2008 at 3:54 PM
Hi,

I'm using EntLib 3.1 for logging to a Sql database from an asp.net app. I'm happy with the default implementation, but would also like to log the user ID (I'm using Windows Authentication) in the table, so that we can figure out who's seeing these exceptions that are logged.

I've done some looking around and haven't seen anything, which leads me to believe either it's something easy that I just missed, or it's something that requires a code change in EntLib, which I'd rather not do if there's a reasonable alternative.

Any input would be appreciated.
Jan 14, 2008 at 5:31 PM
You can use the ManagedSecurityContextInformationProvider to gather context info (see topic "Populating a Log Message with Additional Context Information" in the help file). This however requires changes in the client code to invoke the provider.

Fernando