New to EntLib Logging - Explanations req'd

Topics: Logging Application Block
Jan 25, 2007 at 3:17 PM
I am trying to understand how configuration of EntLib Logging works.

Here is what I think I understand so far:
- listeners: configures where you actually want to log to (EventLog, File, Email, etc)
- formatters: configures how you want the log event to be formatted

Now here is where I need some explanation:
- categorySources: ???
- specialSources: ???

The two sections above seem to deal with defining filtering of sorts. I just want to understand how they work and the best way to use them.

Thanks.
Jan 25, 2007 at 9:03 PM
Greif,

If you haven't already, I recommend reading the documentation under Logging Application Block. In particular, there is also a section within it entitled, Design of the Logging Application Block, that talks about the role of various objects like TraceListeners, Formatters, etc.

When you log messages you assign them to one or more categories. TraceListeners are assigned to categories. This allows you to send different messages to different TraceListeners based on category. Perhaps all messages assigned to the "Exception" Category get sent to both the EventLog and Email, while messages assigned to the "Debug" Category get sent to a rolling flat file.

Special Sources are for special situations:

Logging Errors and Warnings - Assign TraceListeners to it when you want to know about any internal errors occuring when the logging block tries to log a message.

Unprocessed Category - Logs messages to the assigned TraceListeners when you have assigned a log message to a category that does not exist.

All Events - Sends all messages to the TraceListeners assigned to this special source.

Hopefully that helps. For further information, I recommend the documentation and the quickstarts. I also have a lot of tutorials here on every block:

<a href="http://davidhayden.com/blog/dave/category/50.aspx?Show=All">Enterprise Library Tutorials</a>

Regards,

Dave

_____________________________

David Hayden
Microsoft MVP C#
http://www.davidhayden.com/
Jan 25, 2007 at 9:05 PM
My apologies. I was hoping I could embed HTML in the response above to make it easier for you to get to external information, but I guess we can't do that in CodePlex.

Here is the URL to some tutorials I have written on the application blocks:

http://davidhayden.com/blog/dave/category/50.aspx?Show=All

Regards,

Dave

_____________________________

David Hayden
Microsoft MVP C#
http://www.davidhayden.com/