RE: Logging Performance when logging is disabled

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

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 4: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.




David Hayden
Microsoft MVP C#