Writing User name to a custom log

  • Thread starter Thread starter Bob Dufour
  • Start date Start date
B

Bob Dufour

Using the .NET eventlog class to log application errors that are viewable in
the Windows event viewer. We write to a custom log. WE can Write our error
messages to it OK but we want the Current user name to be displayed in the
field USER in the evcent log. We can't find out how this value would be
written to this field in the log entry. We have no trouble getting the user
name, just writing it to the log. Can anyone tell us how this should be
done?

Thanks,

Bob
 
None of the System.Diagnostics.EventLog methods allow you to write the
UserName.
You can use P/Invoke to use the event log API functions directly, or you can
search the internet for a .NET class that someone has written that allows
this feature. I believe Microsoft has a logging Application Block you can
download that allows this as well.

-Rob Teixeira [MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top