Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

All. I am creating some libraries for other teams in my company. They all have different logging mechanisms. I want to provide trace information of what my libraries are doing. What should I to achieve this? Thanks

share|improve this question
1  
This might belong on stack overflow? –  smp7d Dec 1 '11 at 17:06
add comment

2 Answers

up vote 10 down vote accepted

Use the built in Trace mechanism and document the fact.

This way, all they need to do is configure tracing and they can log.

share|improve this answer
    
Thanks for the quick reply –  user394128 Dec 1 '11 at 16:07
add comment

I would actually suggest using the newer TraceSource class, as recommended by the BCL Team during early .NET 2.0 development. This adds some additional bells and whistles like the ability to name sources independently of one another and handle configuration through app.config files.

share|improve this answer
1  
Is it possible to put the configuration for TraceSource in a config file other than app.config file? Thanks –  user394128 Dec 1 '11 at 19:47
    
I would imagine that any of the .NET *.config files (app.config, machine.config, web.config, etc.) would do. Alternatively, you can configure the TraceSource objects entirely via code. As a result, I suppose you could roll your own configuration system backed by a code library to do the work. –  Dan Lyons Dec 2 '11 at 18:41
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.