What should you do?

You work as the application developer at Domain.com. Domain.com uses Visual Studio.NET 2005 as its application development platform.
You are developing a .NET Framework 2.0 application for Domain.com.
You complete the application but as soon as Domain.com users attempt to log on to the application the application fails.
You need to have an entry written to the Windows event log. When you look at the event log viewer you want the source of the events to be listed as TestApp.
You are required to create an event source that can be used to write entries to the event log.
What should you do?

You work as the application developer at Domain.com. Domain.com uses Visual Studio.NET 2005 as its application development platform.
You are developing a .NET Framework 2.0 application for Domain.com.
You complete the application but as soon as Domain.com users attempt to log on to the application the application fails.
You need to have an entry written to the Windows event log. When you look at the event log viewer you want the source of the events to be listed as TestApp.
You are required to create an event source that can be used to write entries to the event log.
What should you do?

A.
If Not EventLog.SourceExists(“TestApp”) Then
EventLog.CreateEventSource(“TestApp”, “Application”)
End If

B.
EventLog.LogNameFromSourceName(“TestApp”, “Application”)

C.
EventLog.LogNameFromSourceName(“TestApp”, “Security”)

D.
If Not EventLog.SourceExists(“TestApp”) Then
EventLog.CreateEventSource(“TestApp”, “Security”)
End If

Explanation:
The code that is used in the answer is the proper code that should be used to create entries into the Application event log.
Incorrect Answers:
B, C, D: The other methods that are used are not correct because the security log is read-only and furthermore the LogNameSourceName method returns the name of an event log for the given event and does not help in creating an event source.



Leave a Reply 1

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


seenagape

seenagape

I agree with the answer. A