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

  • 1
    This might belong on stack overflow?
    – smp7d
    Dec 1 '11 at 17:06

Use the built in Trace mechanism and document the fact.

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


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.

  • 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

LibLog lets your library dynamically attach to whatever logging framework is in use, without any additional dependencies.

It's often nicer than Trace etc. for a user, as they don't need to set anything additional up: if they're using a particular logging library, LibLog will detect it and everything will "just work".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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