Nimble Coder

Adventures in Nimble Coding
posts - 76, comments - 39, trackbacks - 0

January 2009 Entries

Using a delegate and Custom Appender with log4net to display live log text

Recently I needed to display the text that was sent to log4net in a TextBox in a Form. It turns out this is very easy to do using a custom appender and the AppenderSkeleton. The custom appender uses a delegate to allow the host program to define a callback function to handle the log text as necessary. 1. Create a new custom appender class I named my appender DelegateAppender because it needed to use a delegate to pass the text to the Form. using log4net.Core; namespace log4net.Appender { public delegate void LogTextAppend(string text); public class...

posted @ Friday, January 30, 2009 12:42 PM | Feedback (4) | Filed Under [ C# ]

Powered by: