Re: TraceSource and config

2016-01-07 Thread Greg Keogh
> > Yeah you must define the switch. > Now you tell me!! It does say "tracing messages are sent through switches to listeners". Hmmm, I guess that hints I *need* a switch element, but they don't say I *must* have one. As you say in the other messages, the overall idea of trace sources is simple

RE: TraceSource and config

2016-01-07 Thread Adrian Halid
Trace switches can be used in determine what to output to the log. So in my libraries I will log different things at different levels. Error, Warning, Info. Then when I need to debug something I can decide if I am just interested in one of these or all of these. You can also have logic i

RE: TraceSource and config

2016-01-07 Thread Adrian Halid
It’s great to put tracesources in your libraries that you will use for other projects. You can easily modify the web.config or app.config that is using your DLL and instantly get debug information. Great for debugging deployed code. Regards Adrian Halid From: ozdotnet-boun...

RE: TraceSource and config

2016-01-07 Thread Adrian Halid
Yeah you must define the switch. Regards Adrian Halid From: ozdotnet-boun...@ozdotnet.com [mailto:ozdotnet-boun...@ozdotnet.com] On Behalf Of Greg Keogh Sent: Friday, 8 January 2016 6

Re: TraceSource and config

2016-01-07 Thread Greg Keogh
> > Got it working with these changes > BINGO! It wasn't working because I never specified a "switch" with "Verbose". I could never have guessed one was needed, as I thought it was to *restrict* the logging output and therefore I never bothered coding one. Perhaps it's in the fine print, but I'm n

RE: TraceSource and config

2016-01-07 Thread Ian Thomas
It has been in .NET since v2.0 and the docs for ,Net 4.5, 4.6 do give some configuration code that might be useful. Since it has been around a while, and updated, I assume someone finds it useful. (I haven’t used it, instead using a crude write to text debug files) Ian Thomas Albert P

Re: TraceSource and config

2016-01-07 Thread DotNet Dude
My memory sucks then. Got it working with these changes And public void RunAndTrace() { mockSource.TraceInformation("Runit is running now"); mockSource.TraceEvent(TraceEventType.Error, 10

Re: TraceSource and config

2016-01-07 Thread Greg Keogh
> > From memory you use the Trace class directly > Trace.WriteLine("bla bla"); > Nah, I don't think so, I'm using a "TraceSource" and all the samples I've seen make a static one, then write to it. public static TraceSource ts = new TraceSource("MySource"); : ts.TraceInformation("Hello world"); *

Re: TraceSource and config

2016-01-07 Thread DotNet Dude
>From memory you use the Trace class directly Trace.WriteLine("bla bla"); On Fri, Jan 8, 2016 at 9:18 AM, Greg Keogh wrote: > Folks, ever since the TraceSource > > class was invented, I have never seen it wo

TraceSource and config

2016-01-07 Thread Greg Keogh
Folks, ever since the TraceSource class was invented, I have never seen it work. I have created a tiny solution with a Console app and a config file that adds some listeners to a TraceSource, but nothing comes