1

I have a working logger from runtime without using a web.config. I want to do this because I am adding my logger to a DLL I will be distributing. Now I have working version using hierarchy but that is using Root. If I use the web config way of configuring it I can use the following nodes....

<logger name="EventLogger">
  <level value="ERROR" />
  <appender-ref ref="EventLogAppender" />
</logger>
<logger name="FileLogger">
  <level value="INFO" />
  <appender-ref ref="FileAppender" />
</logger>

This allows me to call each log when I want to use it. Basically I want to do an info log for the fileappender and eventlog for errors....I then will call them on demand based on what error is generated, like catch errors will be going to eventviewer and specific log calls will be going to fileappender...does anyone have any good runtime code for log4net? I have seen a lot of examples and they all are for root loggers.

This is basically for my dll to allow users to have logs for specific items, errors and logging. Can anyone explain exactly what the MemoryAppender means...

whreed
  • 133
  • 1
  • 11
  • Possible duplicate of [How to configure log4net programmatically from scratch (no config)](http://stackoverflow.com/questions/769983/how-to-configure-log4net-programmatically-from-scratch-no-config) – stuartd Aug 03 '16 at 22:52
  • MemoryAppender does what it says, it logs log entries to an in-memory store - imagine something like a `List`. Good for unit tests, useless for production code. – stuartd Aug 03 '16 at 22:54

0 Answers0