Search code examples
c#.net-3.5loggingenterprise-library

Adding a 'User' to the eventlog using Enterprise Library Logging Block


I'm using the Enterprise Library Logging application block to allow my application to log various events. This is working fine and the logs can be seen by Event Viewer (eventvwr.exe) going into the Application log.

However, Event Viewer always shows the user field as "N/A". Other applications have the field populated - how do I populate this field?

I have the current user logged into the extended properties of the log entry (using the UnmanagedSecurityContextInformationProvider). This means that I can capture the username and have it appear within Event Viewers 'Description' text box - but I cannot use EventViewer's filtering to see one user's log entries.


Solution

  • I've since found this question which suggests this is not possible without breaking into unmanaged Win32 API code - and a posting over on another site that has a MSFT employee stating the same.

    Looks like I'll have to just put the username in the main body of the message.