You are developing an application by using C#. The application will write events to an event log. You
plan to deploy the application to a server.
You create an event source named MySource and a custom log named MyLog on the server.
You need to write events to the custom log.
Which code segment should you use?

A.
Option A
B.
Option B
C.
Option C
D.
Option D
D
2
0
why why why
1
0
why D
1
0
Because it’s the only solution where the Source Property is correctly set to the given sourcename “MySource”. Additional Info: With the Sourcename you can write to only one EventLog at a time as stated here https://msdn.microsoft.com/en-us/library/system.diagnostics.eventlog(v=vs.110).aspx
That means that only the Source Property has to be set correctly to write to the right EventLog.
3
0
D
1
0
EventLog lets you access or customize Windows event logs, which record information about important software or hardware events. Using EventLog, you can read from existing logs, write entries to logs, create or delete event sources, delete logs, and respond to log entries. You can also create new logs when creating an event source
To write to an event log, specify or create an event source (Source property). You must have administrative credentials on the computer to create a new event source. The event source registers your application with the event log as a valid source of entries. You can use the event source to write to only one log at a time. The Source property can be any random string, but the name must be distinct from other sources on the computer. The event source is typically the name of the application or another identifying string. Trying to create a duplicate Source value throws an exception. However, a single event log can be associated with multiple sources.
3
0