470,590 Members | 2,525 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,590 developers. It's quick & easy.

Implementing Tracing throughout an application

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
2 1535
"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
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.

Similar topics

15 posts views Thread by Agoston Bejo | last post: by
5 posts views Thread by Dabbler | last post: by
2 posts views Thread by deepukutty | last post: by
reply views Thread by cnys | last post: by
reply views Thread by rehto | last post: by
6 posts views Thread by Stephen Torri | last post: by
1 post views Thread by RedLars | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.