Which code segment should you use?

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?

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



Leave a Reply 6

Your email address will not be published. Required fields are marked *


Najlepszy Programista Swiata DAGO

Najlepszy Programista Swiata DAGO

D

Najlepszy Programista

Najlepszy Programista

why why why

Lord Vader

Lord Vader

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.