You are creating a .NET Remoting object. You want to add code to the object to log error messages and warning messages. You want the log messages written to both a log file and to the Windows application log. Which code segment should you use?
A.
EventLog eventLog = new EventLog(“remobj”);
FileStream fileLog = File.Create(“remobj.log”);
Trace.WriteLine(eventLog, “sample message”);
Trace.WriteLine(fileLog, “sample message”);
B.
EventLog eventLog = new EventLog(“remobj”);
FileStream fileLog = File.Create(“remobj.log”);
Trace.Write(eventLog);
Trace.Write(fileLog);
Trace.WriteLine(“sample message”);
C.
Trace.Listeners.Add(new EventLogTraceListener(“remobj”)); Trace.Listeners.Add(
new TextFileTraceListener(“remobj.log”));
Trace.WriteLine(“sample message”);
D.
Trace.Listeners.Add(new EventLogTraceListener());
Trace.Listeners.Add(
new TextFileTraceListener(“remobj.log”));
Trace.WriteLine(“sample message”);