2

I am using Log4net to produce different kind of logs and using RollingFileAppenders which rolls on a given size.

Now i have a new requirement that a log should be visible on a windows form therefore i am looking for some event that can be handled on each log entry within my application so i can display that particular log entry in my form as well.

Or there may be some appender which gives such functionality.

Any idea on this?

Mubashar
  • 12,300
  • 11
  • 66
  • 95

2 Answers2

4

I'd suggest writing your own appender - it's really easy to do:

  1. Create a class that inherits from AppenderSkeleton
  2. Override the Append method

Simple!

Here is an example of a custom appender that updates a textbox.

Cocowalla
  • 13,822
  • 6
  • 66
  • 112
  • 1
    I just added an example for you. You can locate others on http://www.google.com/codesearch if you need them – Cocowalla Apr 12 '10 at 18:38
-1

As I suggest in this answer, you could set up a MemoryAppender and monitor log messages in memory. It does not expose an event but you could easily set up a timer that retrieves the latest messages.

Community
  • 1
  • 1
Peter Lillevold
  • 33,668
  • 7
  • 97
  • 131