0
Answer

how to write multiple data into eventviewer <eventData>

Hi team,
 
I have a requirement to write multiple data intems into eventviewer <eventData> like below
  • <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
  • <System>
    <Provider Name="Elib" />
    <EventID Qualifiers="0">0</EventID>
    <Level>4</Level>
    <Task>0</Task>
    <Keywords>0x80000000000000</Keywords>
    <TimeCreated SystemTime="2014-01-03T12:42:30.000000000Z" />
    <EventRecordID>33</EventRecordID>
    <Channel>Elib</Channel>
    <Computer>48vtvs1.ct.chevrontexaco.net</Computer>
    <Security />
    </System>
  • <EventData>
    <Data>Entry1</Data>
    <Data>Entry2</Data>
    </EventData>
    </Event>
 
I achieved with the help of eventlog, with the below sample code
EventLog.WriteEvent("Application", new EventInstance(1001, 0, EventLogEntryType.Information), 
new object[] { "Entry1", "Entry2" });
 
but my requirement is to add attributes to each data node like below
  • <EventData>
    <Data name="title">Entry1</Data>
    <Data name="message">Entry2</Data>
    </EventData>
    </Event>
  • please help me , how can i add attributes to each node in <evendata>