Configuring a TraceSource

by Matt 27. July 2007 04:50

A common pattern in log4net is to create an instance of a logger in a class, passing in the name of the class. This logger can then be setup via config files and violin, you've got tracing that you can turn on and off at the class level. Rather handy.

TraceSource allows exactly the same thing. Simply pass a name into the constructor and define the parameters in the app.config. But the common idiom is to not build a TraceSource per class, but group them at a more logical (as in "not-physical", rather than Vulcan) level, usually named after a namespace, but sometimes also a class or other logical identifier. This gives you finer control of the logging of an entire feature set.

Why am I telling you this?

Because generally, the .net framework doesn't have much logging of what it's doing. .net 3 has tons, and it's all done through TraceSources. This page on msdn details how to turn on tracing for WCF. Here are the TraceSources defined:

  • System.ServiceModel: Logs all stages of WCF processing, whenever configuration is read, a message is processed in transport, security processing, a message is dispatched in user code, etc.
  • System.ServiceModel.MessageLogging: Logs all messages that flow through the system.
  • System.IdentityModel
  • System.ServiceModel.Activation
  • System.IO.Log: Logging for the .NET Framework interface to the Common Log File System (CLFS).
  • System.Runtime.Serialization: Logs when objects are read or written.
  • CardSpace

Quite a few sources. But looking at the recommended tracing levels, or using the Service Configuration Editor, you might be surprised to see more than just "System.ServiceModel" or "System.ServiceModel.MessageLogging". I'm certainly regretting not finding the "CardSpace" source sooner.

WPF gets in on the act too, with it's own set of TraceSources:

  • System.Windows.Media.Animation
  • System.Windows.Data: Databinding
  • System.Windows.DependencyProperty: Tracing for the dependency property system
  • System.Windows.Documents
  • System.Windows.Freezable: Tracing for objects that have been made immutable
  • System.Windows.Markup: All about XAML
  • System.Windows.NameScope: Tracing naming and the scopes used for name lookup and collisions
  • System.Windows.ResourceDictionary
  • System.Windows.RoutedEvent

The odd thing about WPF logging is that not only do you have to configure it in your app.config, you also need to enable a registry key. I don't know why the config isn't enough, I guess it's to do with performance.

Tags:

Comments (76) -

Sanora Klosterman
Sanora Klosterman
2/11/2011 5:17:45 AM #

got here form ask ... great article and I definitely can understand. Not sure if you heard, the new apple ipad might be coming out some time soon .. I am looking forward to it, pretty interesting news.

Reply

Fort Lauderdale Rentals
Fort Lauderdale Rentals
3/24/2011 6:28:21 PM #

Well I got to be honest here,Generally I do not post on blogs, but I would like to say that this publish really forced me to do so! really nice publish! Will definitly keep me coming back.!..Thanks)

Reply

network security new york
network security new york
5/19/2011 1:55:02 AM #

This is a very nice post.This is also very beautiful.
Because it contains lots of important information.It helps me a lot.I really have enjoyed reading your blog.
I will love to visit everyday.Keep up doing good work.Thank you.

Reply

LAURENCE  Debora
LAURENCE Debora
5/22/2011 4:55:59 AM #

Recherche thématique sur plusieurs thèmes, c'est sukoga.com, moteur.

Reply

LAURENCE  Debora
LAURENCE Debora
5/27/2011 8:31:56 AM #

Liste d'annuaires détaillées pour faciliter le référencement, Créez votre propre article.

Reply

suv reviews
suv reviews
7/20/2011 10:34:05 PM #

Is it ok if I quote your article in my monthly newsletter? I would think this article suits my topic perfectly. Well ya, thanks for posting this article.

Reply

best hybrid cars 2011
best hybrid cars 2011
7/22/2011 4:46:23 AM #

Per il tuo bambino scegli Moncler. Una scelta di capi, estivi ed invernali, eccezionali. Tuo figlio sarà sempre alla moda e potrà muoversi in totale comodità.

Reply

LAURENCE  Debora
LAURENCE Debora
7/27/2011 10:11:52 AM #

Bienvenue sur annuaires-gratuit.com.Des fonctionnalités inédites, nombreuses annuaires.

Reply

LAURENCE  Debora
LAURENCE Debora
7/28/2011 5:38:01 AM #

Notre objectif et de vous simplifiée les choses et faire connaître vos annuaires.

Reply

DEBORA Laurence
DEBORA Laurence
8/1/2011 7:52:31 AM #

Il ne vous reste plus qu' à créer votre propre annuaire, l'inscription est  gratuite .

Reply

DEBORA Laurence
DEBORA Laurence
8/2/2011 4:10:03 AM #

Service page annuaires : Trouver l'annuaire qu'il vous faut sur annuaires-gratuit.com .

Reply

DEBORA Laurence
DEBORA Laurence
8/8/2011 10:05:38 AM #

Vous pouvez configuré vos systèmes de paiement allopas sur annuaires-gratuit.com

Reply

john
john
8/27/2011 3:51:53 AM #

Hey , some great)inforeading more (info.. Just added to your RSS feed Smile

Reply

Miami Tree Removal Cost
Miami Tree Removal Cost
10/7/2011 6:31:03 AM #

I wish I had the time to run one of these web blogs.  This must be a lot of fun to make and run.  

Reply

Thanks for the info! I am recording this now at http://peter@sousaart.com

Reply

Eric
Eric
10/22/2011 9:45:22 AM #

Hello

Nice, post here may come back soon

Reply

Robert
Robert
10/23/2011 11:58:56 AM #

Hi

interresting, post here may come back soon
Keep like this

Reply

Stephane
Stephane
10/23/2011 7:25:30 PM #

hi,

Nice, post here
Keep like this

Reply

Stephane
Stephane
10/23/2011 8:45:34 PM #

Hello

Nice, post here
continue updating your blog

Reply

Stephane
Stephane
10/23/2011 10:50:15 PM #

Hi

Nice, post here
Keep like this

Reply

Lisa
Lisa
10/24/2011 12:23:50 AM #

Hello

interresting, post here
keep update

Reply

Lisa
Lisa
10/24/2011 12:25:30 AM #

hello there,

interresting, post here will came back
keep update

Reply

iPhone games reviews
iPhone games reviews
12/1/2011 5:02:31 AM #

Good job  , amazing Post !!!

Reply

photographe mariage paris
photographe mariage paris United States
6/8/2015 2:31:23 AM #

Thanks for this wonderful article. One other thing is that most digital cameras arrive equipped with a new zoom lens so that more or less of a scene to become included through 'zooming' in and out. All these changes in concentration length are generally reflected from the viewfinder and on big display screen right at the back of the exact camera.

Reply

Philix
Philix United States
11/19/2015 4:40:40 PM #

Ace Website.

Reply

Marianne Babers
Marianne Babers United States
1/15/2016 3:48:04 AM #

getting the last pair of shoes in your size AWESOME!

Reply

Blake Krist
Blake Krist United States
1/15/2016 4:04:10 AM #

Congrats! So glad to see this site getting the recognition it deserves, the world can always use a little more awesome.

Reply

Loren Benward
Loren Benward United States
1/15/2016 4:15:23 AM #

Printing out an essay or paper, reading the first line and realizing there aren't any mistakes.<br />AWESOME!

Reply

Jose Bacone
Jose Bacone United States
1/15/2016 4:51:30 AM #

Thaaaat IS awesome! lol hehe

Reply

Blake Krist
Blake Krist United States
1/15/2016 5:44:17 AM #

I can't wait to read this masterpiece. Ordering off the menu at fast food restaurants and old dangerous playground equipment have to be in the book!

Reply

Luvenia Colier
Luvenia Colier United States
1/15/2016 5:54:05 AM #

Let me be the first to say: Congrats, Neil! I've been following this site from day one, and have loved every single day of awesomeness that it has delivered. You deserve all the success coming your way. Keep it up!AWESOME!

Reply

Isreal Payor
Isreal Payor United States
1/15/2016 6:24:03 AM #

this is awesome like the book of awesome

Reply

Normand Schwarz
Normand Schwarz United States
1/15/2016 6:43:22 AM #

Thaaaat IS awesome! lol hehe

Reply

Lashawn Ulwelling
Lashawn Ulwelling United States
1/15/2016 7:06:43 AM #

Congrats. And all of the items featured so far should be in the book.

Reply

Dion Newcomer
Dion Newcomer United States
1/15/2016 7:14:26 AM #

Congrats! So glad to see this site getting the recognition it deserves, the world can always use a little more awesome.

Reply

Jose Bacone
Jose Bacone United States
1/15/2016 7:15:25 AM #

this is awesome like the book of awesome

Reply

Antony Goren
Antony Goren United States
1/15/2016 7:44:48 AM #

I love the dolphin saving you one.

Reply

Lashawn Ulwelling
Lashawn Ulwelling United States
1/15/2016 7:49:12 AM #

Thaaaat IS awesome! lol hehe

Reply

Freddy Stuart
Freddy Stuart United States
1/15/2016 8:29:36 AM #

Congrats! So glad to see this site getting the recognition it deserves, the world can always use a little more awesome.

Reply

Cherrie Gervase
Cherrie Gervase United States
8/25/2016 3:59:08 AM #

Hola! This is my new visit to your blog! We are a group of volunteers and starting a new initiative in a community in the same niche. Your post provided us valuable information to work on. You have done a marvelous job!

Reply

best seo tools
best seo tools United States
10/24/2016 6:11:50 PM #

Reply

Thi Rohrbach
Thi Rohrbach United States
12/3/2016 3:12:59 AM #

For example, a lot of companies seek Internet and computer savvy individuals in these times, so make sure you learn key technical skills such as Internet marketing, programming, Burnaby mobile app, Richmond android development, or professional programs such as QuickBooks that could help you in the workplace. If you're just starting out, popular apps that are easy to use and troubleshoot are your best bet. You will be provided with Angry Birds Version 1.5.3. Show Gratitude: We all know that customers have options, so when they buy an item from you, be thankful. If an organization needs ipad for only an event then it does not need to purchase it.

Reply

granos
granos United States
10/5/2017 1:36:54 PM #

Hey There. I discovered your weblog the usage of msn. That is a very smartly written article. I will be sure to bookmark it and come back to read extra of your useful info. Thanks for the post. I will definitely return.

Reply

disqus
disqus United States
8/4/2018 3:35:44 AM #

Cheers, a really interesting read – added to bookmarks so will pop back for new content and to read other people’s comments. Thanks again.

Reply

Patsy Delamarter
Patsy Delamarter United States
8/16/2018 11:08:47 PM #

Hello. impressive job. I did not anticipate this. https://php665.com/

Reply

Bryon Turvey
Bryon Turvey United States
8/19/2018 5:05:33 PM #

With thanks! Valuable information! https://php665.com/

Reply

Glayds Dawoud
Glayds Dawoud United States
8/19/2018 7:47:17 PM #

Hello. impressive job. I did not anticipate this. https://php665.com/

Reply

Debrah Fukui
Debrah Fukui United States
8/28/2018 1:22:53 PM #

I got what you mean,saved to fav, very decent site. https://php665.com/

Reply

Kenton Schop
Kenton Schop United States
8/28/2018 10:02:33 PM #

Don’t wear seat belts lest you drown in you own urine?

Reply

Emiko Issac
Emiko Issac United States
8/29/2018 5:48:26 PM #

I like the helpful info you provide in your articles. I will bookmark your weblog and check again here regularly. https://php665.com/

Reply

Jonathon Schmahl
Jonathon Schmahl United States
8/30/2018 12:02:15 PM #

Don’t wear seat belts lest you drown in your own urine?

Reply

Carina Yeilding
Carina Yeilding United States
8/31/2018 3:48:01 PM #

I like the helpful info you provide in your articles. I will bookmark your weblog and check again here regularly. https://php665.com/

Reply

Rhett Lapoint
Rhett Lapoint United States
8/31/2018 3:49:02 PM #

Don’t wear seat belts lest you drown in you own urine?

Reply

Cecila Paukert
Cecila Paukert United States
9/1/2018 7:18:37 PM #

I got what you mean,saved to fav, very decent site. https://php665.com/

Reply

Werner Pertubal
Werner Pertubal United States
9/1/2018 7:18:38 PM #

Black on black in the Charger I'm creepin' Rub me the right way, you might get a genie B.o.B, black Houdini

Reply

Norman Nagelhout
Norman Nagelhout United States
9/2/2018 8:06:42 PM #

Don’t wear seat belts lest you drown in you own urine?

Reply

Burma Rowand
Burma Rowand United States
9/3/2018 9:04:40 PM #

good stuff. I will make sure to bookmark your blog. https://php665.com/

Reply

Kirby Doney
Kirby Doney United States
9/4/2018 9:22:45 AM #

With thanks! Valuable information!

Reply

Enrique Barz
Enrique Barz United States
9/5/2018 5:48:18 PM #

I’m quite certain I’ll learn lots of new stuff right https://php665.com/

Reply

Kenia Coller
Kenia Coller United States
9/5/2018 5:48:31 PM #

Don’t wear seat belts lest you drown in your own urine?

Reply

Coleman Jarret
Coleman Jarret United States
9/7/2018 4:56:15 PM #

Don’t wear seat belts lest you drown in you own urine?

Reply

Roscoe Hussey
Roscoe Hussey United States
9/7/2018 4:57:33 PM #

of writing i am as well delighted to share my know-how here with colleagues. https://php665.com/

Reply

Clyde Akhavan
Clyde Akhavan United States
9/9/2018 4:38:05 PM #

here! Good luck for the next! https://php665.com/

Reply

Nathanael Gellespie
Nathanael Gellespie United States
9/9/2018 4:38:07 PM #

With thanks! Valuable information!

Reply

Rosalva Prindall
Rosalva Prindall United States
9/10/2018 7:18:42 PM #

With thanks! Valuable information!

Reply

Orville Nonroe
Orville Nonroe United States
9/11/2018 11:47:26 AM #

What’s up, after reading this awesome piece https://php665.com/

Reply

Alejandro Junk
Alejandro Junk United States
9/12/2018 5:20:20 PM #

Don’t wear seat belts lest you drown in you own urine?

Reply

Gary Costine
Gary Costine United States
9/12/2018 6:50:13 PM #

of writing i am as well delighted to share my know-how here with colleagues. https://php665.com/

Reply

Sydney Desue
Sydney Desue United States
9/14/2018 1:46:32 PM #

Don’t wear seat belts lest you drown in you own urine?

Reply

Tyler Bockrath
Tyler Bockrath United States
9/14/2018 10:13:59 PM #

Don’t wear seat belts lest you drown in your own urine? https://php665.com/

Reply

Angelic Mccurry
Angelic Mccurry United States
9/17/2018 9:35:21 PM #

Don’t wear seat belts lest you drown in your own urine?

Reply

Ofelia Delveechio
Ofelia Delveechio United States
9/18/2018 10:32:47 PM #

Black on black in the Charger I'm creepin' Rub me the right way, you might get a genie B.o.B, black Houdini

Reply

Georgianna Kosuta
Georgianna Kosuta United States
9/19/2018 12:32:03 AM #

With thanks! Valuable information! https://php665.com/

Reply

Barton Angelos
Barton Angelos United States
9/19/2018 8:16:15 PM #

With thanks! Valuable information!

Reply

Maryam Akerley
Maryam Akerley United States
9/20/2018 12:46:11 PM #

Black on black in the Charg I'm creepin' Rub me the right way, you might get a genie B.o.B, black Houdini

Reply

Felix Lacko
Felix Lacko United States
9/20/2018 2:44:52 PM #

of writing i am as well delighted to share my know-how here with colleagues. https://php665.com/

Reply

Add comment

biuquote
  • Comment
  • Preview
Loading

Rel=Me

Month List

RecentComments

Comment RSS