views:

36

answers:

2

Is there a maximum number of trace sources for app.config, and by definition listeners as well?

+1  A: 

Not a documented one. Which is consistent with almost all .NET framework classes, there are no hard-coded limits. You'll eventually run out of a system resource, usually memory or paging file. Or user patience.

Hans Passant
Thats what I thought. I had set up about 20 and they weren't working, but I stupidly forgot to switch them. I know 20 is too much.
scope_creep
+1  A: 

I wouldn't say 20 is necessarily too many - it depends on the size of the application. Think of these as virtual log files, for which you can independently control the output. If you want the ability to turn up the volume on some logging without getting a lot of additional logging in production, having separate trace sources (with the associated source switches) is the way to do that. My rule of thumb is having one per major component. The one issue with having 20 is whether you'll be disciplined enough to correctly use them or whether you'll end up using just a few.

Mike Kelly