Search OnLog Event - log4net

I am using Log4net to create different types of logs and use RollingFileAppenders that rolls at a given size.

Now I have a new requirement that the log should be visible on the Windows form, so I am looking for some event that can be handled on every log entry in my application so that I can display that particular record in my form.

Or there might be some appender that gives this kind of functionality.

Any idea on this?

+2


source to share


2 answers


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

  • Create a class that inherits from AppenderSkeleton
  • Override add method


Simple!

Here's an example of a custom application that updates a text box.

+4


source


As I suggest in this answer , you can customize the MemoryAppender and keep track of the log messages in memory. It doesn't show the event, but you can easily set up a timer that fetches the latest messages .



-1


source







All Articles