When do the custom properties get initialised in log4net appender

165 Views Asked by At

I have written log4net custom appender with the filename and buffersize as its custom properties.

<log4net debug="true">
  <appender name="Log4NetAppender" type="Log4NetAppender.Log4NetAppender" >
    <filePath>C:/temp/logs.log</filePath>
    <bufferSize>4096</bufferSize>
    <layout type="log4net.Layout.PatternLayout">
      <ConversionPattern value="%d%message"/>
    </layout>
  </appender>
  <root>
    <level value="ALL" />
    <appender-ref ref="Log4NetAppender"/>
  </root>
  </log4net>

In my custom appender code, if I try to access these properties in constructor it gives me null value. However in the Append(loggingEvent) method it gives me the correct value for these properties. When are these properties initialised and can i initialise them in the constructor of my custom appender?

0

There are 0 best solutions below