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

Tracing using a global trace object...

P: n/a
Hi,
I wonder how I should use dotNets TraceSource logging class globally within my C# application.

All examples I have seen only use the TraceSource class in the Main method but I need to use it from everywhere...

Should I wrap the TraceSource object into a Singleton class or is there a better way of doing this?

Thanks in advance!
/Wayne
---
Posted via DotNetSlackers.com
Feb 1 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hello Wayne,
>All examples I have seen only use the TraceSource class in the Main method
but I need to use it from everywhere...
Interesting, I think I haven't really seen any examples that work this way
:-)

The main feature description in MSDN has a sample that simply uses a
static variable for a TraceSource - in this case it's private, but I don't
see a reason why you wouldn't make it public or use a public property.
Here's the article in case you haven't seen it:
http://msdn2.microsoft.com/en-us/library/ms228993.aspx

Please let me know if I'm misunderstanding your question - I'm not totally
sure my reply fits your concerns.
Oliver Sturm
--
http://www.sturmnet.org/blog
Feb 1 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.