Initializing custom trace listeners in web.config

B

boldtbanan

I've created a custom trace listener which I'd like to initialize in
the web.config file of my application. I noticed that I can use the
initializeData attribute to pass a string to the constructor of my
custom trace listener, but is there any way to pass multiple
parameters to the constructor through the web.config initialization?

For example, I have a custom trace listener that sends email
notification of errors. I'd like to configure it through the
web.config with a list of addresses to notify as well as an
originating address for the message. I found that I can do this by
passing a delimited string such as:

(e-mail address removed)|[email protected];[email protected]

where the address before the pipe is the originating address and the
addresses after are the target recipients. I'd then split the string
and assign variablese accordingly. However, this isn't as clean as
I'd like. I'd much rather pass both sets of addresses as separate
parameters, but I can't seem to find a way to do that through the
web.config without using additional appSettings parameters which is
also not as clean as I'd like. Is it possible to initialize a trace
listener with multiple parameters through the web.config? Also, I'm
using the 1.1 framework for this specific application, but I'm curious
if there's a way to do this in any version.

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top