You create Microsoft Windows-based applications. You are creating a stock trading application. The application keeps track of stock prices and raises events when the stock prices increase or decrease. The events are raised based on specific thresholds. When the events are raised, users specify whether to buy, sell, or hold the stocks. The stock trading application currently uses the Trace class to log the events raised by the application and the user responses. The raised events and the user responses are then logged to a Windows application log. You change the application logging mechanism to meet the following requirements:
Log entries are saved in a central database.
Log entries are also saved to the local application log.
Other applications are able to use the same logging mechanism.
The application code is changed as little as possible.
You create a central database to store log entries for multiple databases. You need to choose a system-wide logging mechanism that is reused by the application and is a part of the application design structure.
What should you do?
A.
Create a custom TraceListener class to save data to a central database. Compile the class to a dynamic-link library (DLL). Use the DLL in the application. Change the code to add an instance of the custom TraceListener class to the Listeners collection of the Trace class.
B.
Create a custom TraceListener class to save data to a central database. Compile the class to a dynamic-link library (DLL). Use the DLL in the application. Change the code to add an instance of the custom TraceListener class to the Listeners collection of the Trace class. Change the application code where log entries are created to create the entry twice, one for the local log and one for the database.
C.
Change the application to use a DataSet object to store logging information and save the dataset to the central database.
D.
Change the application to use a SqlCommand object to insert log entries to the central database.