How do I use EventLogTraceListener? Iis documentation correct?

  • Thread starter Thread starter Stan
  • Start date Start date
S

Stan

According to MSDN the following config files settings provide send tracing
information to event log:

<add name="MyListener"
<add name="MyEventListener"
type="System.Diagnostics.EventLogTraceListener, Version,
Culture, PublicKeyToken"
initializeData="MyConfigEventLog"/>

This doesn't work though.

How do I use EventLogTraceListener?

Thanks,

-Stan
 
For a TextWriterTraceListener, the following works for me:

<add name="BTListener"
type="System.Diagnostics.TextWriterTraceListener,System,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
initializeData="C:\temp\BTFileProcessing.log" />

José
 
From the GAC (\WINNT\Assembly).
The values I have are those installed with the 1.1 Framework for the
"System" assembly

José
 
Hello Stan,

José is correct. In addition, some fields like PublicKeyToken are optional,
you can simplify it as the following:

<add name="MyEventListener"
type="System.Diagnostics.EventLogTraceListener"
initializeData="MyConfigEventLog"/>

Hope this helps.

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Hello Stan,

Thanks for your response.

For the EventLogTraceListener, the initializeData specifies the event log
to send events to. You can go to "Control Panel" -> "Administrative Tools"
-> "Event Viewer" to see the result. As in this case, an entry named
MyConfigEventLog will be created in the event log.

While for the TextWriterTraceListener, the initializeData attribute
specifies a file to output data to.

Please feel free to let me know if you have any problems or concerns.

Have a nice day!

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
I did not know about the simplified way...
I much prefer it since it is not version related.

By the way, I really agree with Stan, the documentation regarding usage of
tracing in the .exe.config file is rather confusing. It could be good to
update it ;-)

José
 
Back
Top