RE: Logging Performance when logging is disabled

Topics: Logging Application Block
Jan 4, 2007 at 8:00 PM
Continuing this thread:

http://www.gotdotnet.com/codegallery/messageboard/thread.aspx?id=295a464a-6072-4e25-94e2-91be63527327&mbid=7c32b30e-c95a-4dee-bbdd-2c803f9e05b6&threadid=bcebb24a-6767-447e-a4eb-6ee2e8e86427

I actually perfer Cory's solution of moving the call to CollectIntrinsicProperties to inside of ShouldLog(). ShouldLog() is always called in LogWriter.Write(LogEntry log) before writing a log entry, and ShouldLog() calls LogFilterHelper.CheckFilters(log) to check all filters. It seems sensible to me that CheckFilters() be called before doing anything expensive.

Another issue in this area that I have mentioned before relates to the logging level (SwitchLevel) of each category. To improve logging performance, it should be ascertained that there is at least one active LogEntry category before doing anything expensive (such as calling CollectIntrinsicProperties). I'm guessing that a reworking of the use of the LogSource.ShouldTrace() method might do the trick.
Jan 17, 2007 at 5:24 PM
You may want to use the IssueTracker if you have an issue with the way the logging application block is handling performance when there is nothing to be logged.

I only say this because your concerns and any requests will probably get lost in the forums and not get as much attention as they could in the Issue Tracker.

Regards,

Dave

_________________________

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