Reputation: 315
I need to read an entry from Windows Event Logs using the EventLog API, modify it and over-write that log entry. For e.g.: if I do something like this:
log.Entries[0].Message = "Custom Message";
Then I get an error saying
"Error1 Property or indexer 'System.Diagnostics.EventLogEntry.Message' cannot be assigned to -- it is read only"
Is there any other way to do this?
Thanks in advance, Kiran
Upvotes: 0
Views: 206
Reputation: 1729
Write a Windows Event Logentry with the static EventLog Class.
Examplecode :
EventLog.WriteEntry( "your message", EventLogEntryType.<<yourtype>>);
For further information please consult the documentation (http://msdn.microsoft.com/en-us/library/system.diagnostics.eventlog.aspx).
Upvotes: 1
Reputation: 3606
No, Event logs can not be modified. the ReadOnly
control is because of this.
You can create new logs or clear current logged items, but you can not modify an existing logged item! this is a privacy control
Upvotes: 3