You have the following code (line numbers are included for reference only):
You need to ensure that if an exception occurs, the exception will be logged.
Which code should you insert at line 28?

A.
Option A
B.
Option B
C.
Option C
D.
Option D
Explanation:
* XmlWriterTraceListener
Directs tracing or debugging output as XML-encoded data to a TextWriter or to a Stream, such as a
FileStream.
* TraceListener.TraceEvent Method (TraceEventCache, String, TraceEventType, Int32)
Writes trace and event information to the listener specific output.
Syntax:
[ComVisibleAttribute(false)]
public virtual void TraceEvent(
TraceEventCache eventCache,
string source,
TraceEventType eventType,
int id
)
B
0
0
Why not others? Most shitty question I ever seen in any exam.
0
0
So true….
0
0
keyword is listener. to direct output to other locations add an appropriate trace listener obj to the listeners collection.
textwritertracelistener and xmlwritertracelistener and eventlogtracelistener
0
0
B is correct answer
————
A do nothing because TraceSource requires listeners – there are no listeners.
C – “MyAppErrors” is source, and it might be not created. It’s required to have existing source
D – “Applications” source exists, but it reqires admin permissions – there is no warranty that application has sufficient permissions to access it.
0
0