文档介绍:Exam: 070-320
Title : XML Web Services & ponents
With
Ver :
070-320
Note:
Section A contains 130 questions. Section B contains 101 questions.
The total number of questions is 231.
Section A
QUESTION 1 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("CertKobj");
File Stream file Log = ("";
(eventLog, "sample message");
(fileLog, "sample message");
B. EventLog eventLog = new EventLog("CertKobj");
FileStream fileLog = ("");
(eventLog);
(fileLog);
("sample message");
C. (new
EventLogTraceListener("CertKobj"));
(
new TextFileTraceListener(""));
("sample message");
D. (new EventLogTraceListener());
(
(""));
("sample message");
Answer: C
Explanation: Listeners direct the tracing output to an appropriate target, such as a log, window, or text file. An
EventLogTraceListener redirects output to an event log. A TextWriterTraceListener redirects output to an
instance of the Text Writer class. We should take care to use the new EventLogTraceListener("remobj")
constructor.
Note: Any listener in the Listeners collection gets the same messages from the trace output methods. If we set
up two listeners: a TextWriterTraceListener and an
EventLogTraceListener. Each listener receives the same message. The TextWriterTraceListener would direct its
output to a stream, and the EventLogTraceListener
would direct its output to an event log.
Reference: Visual Basic and Visual C# Concepts, Trace Li