Hi all, I am currently in the process of switching my app and a few libraries I wrote to log4net. So far everything works fine, but now I am at a point where I need the help of people who have more insight into log4net than me.
I want to accomplish two things: First I want an appender to output to a multiline textbox of my app. I think that this might be easiest by working with an appender similar to FireEventAppender from the examples, or are there other suggested ways to do this(*)? The second thing I want to achieve is a little trickier. My old, custom logging framework had a function called SetJob(string currentJob) that would output the string given to what is called the appenders in log4net, but there would be special handling to update a small label in the UI to inform the user of what the app is currently doing. I thought that the best way to get a similar behaviour was to log objects of type JobMessage or something to replace SetJob(currentJob), and writing a filter to filter based on type and an appender that would write this info to the UI. Again, it seems that something along the lines of FireEventAppender would be the easiest way to do this. This brings me to the core question: FireEventAppender is implemented as a weird kind of singleton. Implementing something like FireEventAppender as a singleton would of course be possible, but then I could only have 1 and would have to do the filtering (directing most output to the multiline textbox and some to the Current Job UI Label) myself. It seems to me that this is not entirely in the spirit of log4net, which is why I (finally) ask: Is there a possibility to get the reference to a certain Appender that was created via config file magic? Something similar to LogManager.GetLogger(), along the lines of LogManager.GetAppenderByName(string name)? If it isn't, do you have any suggestions on how to implement the behaviour described above? TIA, Daniel *) As a sidenote: Since some of my function can output a lot of messages within a short amount of time that I want to appear in the multiline textbox, I implemented a mechanism to store the messages in memory and append them to the multiline textbox via a timer event. The log4net BufferingForwardingAppender seems to be an alternative to this technique, but as far as I understand it there is no way to get the current implementation to output either every n seconds or whenever the buffer is full, whichever comes first. Is this correct? Is there an implementation that does it this way maybe? -- Daniel Bachler http://www.danyx.com Contact details: http://www.danyx.com/contact The attatched file starting with ATT is a signature for this message. To understand how you can verify my identity based on this signature, please go to http://www.danyx.com/WhyGPG
pgpv20sHM6ErX.pgp
Description: PGP signature
