By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,018 Members | 1,204 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,018 IT Pros & Developers. It's quick & easy.

Implementing Tracing throughout an application

P: n/a
Hello,

I have a design question regarding Tracing and Trace
Switches.

I understand that Trace Switches can be configured through
an application's .config file. When a switch is
instantiated, the application automatically checks the
configuration file for a matching named switch. If there's
a match, the configuration parameters are set.

My question is this: In a non-trivial application that
spans several classes and several modules, would you
declare and instantiate a single trace switch that gets
passed throughout the application where needed? Or would
you declare and instantiate unique switches within the
classes they are needed, making use of the common name
that appears in the .config file.

E.g. Application with 3 classes - Controller, Alpha, and
Beta. Tracing is required in Alpha and Beta.

Would you declare the trace switch in Controller and pass
reference to Alpha and Beta?
OR
Would you declare individual switches in both Alpha and
Beta where required?

Sincerely,

Trace User
Jul 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"Trace User" <bl*@bling.com> wrote in message
news:08****************************@phx.gbl...
Hello,

I have a design question regarding Tracing and Trace
Switches.

I understand that Trace Switches can be configured through
an application's .config file. When a switch is
instantiated, the application automatically checks the
configuration file for a matching named switch. If there's
a match, the configuration parameters are set.

My question is this: In a non-trivial application that
spans several classes and several modules, would you
declare and instantiate a single trace switch that gets
passed throughout the application where needed? Or would
you declare and instantiate unique switches within the
classes they are needed, making use of the common name
that appears in the .config file.

E.g. Application with 3 classes - Controller, Alpha, and
Beta. Tracing is required in Alpha and Beta.

Would you declare the trace switch in Controller and pass
reference to Alpha and Beta?
OR
Would you declare individual switches in both Alpha and
Beta where required?


It depends upon the switch. If the switch is class specific, I declare it
in the class (static). If it's not class specific, I declare it once in
each assembly.
Jul 21 '05 #2

P: n/a
I know, this doesn't answer the question below, but as an aside . . .

If you're doing that much tracing, you may want to consider something like
log4net. You can dynamically change the level of tracing that is output by
updating an XML config file, it's fast, stable, and makes tracing really
easy.

We're using it in several projects. It's open source and can be found at
http://log4net.sourceforge.net/

Robert
"Trace User" <bl*@bling.com> wrote in message
news:08****************************@phx.gbl...
Hello,

I have a design question regarding Tracing and Trace
Switches.

I understand that Trace Switches can be configured through
an application's .config file. When a switch is
instantiated, the application automatically checks the
configuration file for a matching named switch. If there's
a match, the configuration parameters are set.

My question is this: In a non-trivial application that
spans several classes and several modules, would you
declare and instantiate a single trace switch that gets
passed throughout the application where needed? Or would
you declare and instantiate unique switches within the
classes they are needed, making use of the common name
that appears in the .config file.

E.g. Application with 3 classes - Controller, Alpha, and
Beta. Tracing is required in Alpha and Beta.

Would you declare the trace switch in Controller and pass
reference to Alpha and Beta?
OR
Would you declare individual switches in both Alpha and
Beta where required?

Sincerely,

Trace User

Jul 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.