سؤال

So this is the code:

 <appender name="RollingLogFileAppender_message" type="log4net.Appender.RollingFileAppender">
  <lockingModel type="log4net.Appender.FileAppender+MinimalLock"/>
  <file value="Tickers\Ticker1.txt" />
  <filter type="log4net.Filter.StringMatchFilter">
    <stringToMatch value="|Parser|DynamicData|1|" />
  </filter>
  <filter type="log4net.Filter.DenyAllFilter" />
  <staticLogFileName value="false" />
  <appendToFile value="true" />
  <rollingStyle value="Once" />
  <maxSizeRollBackups value="3" />
  <maximumFileSize value="5KB" />
  <layout type="log4net.Layout.PatternLayout">
    <conversionPattern value="%message%newline" />
  </layout>
</appender>

I don't understand why the log files keep growing without rolling to another file. not even for days, not to mention the 5KB limit I stated in the code.

هل كانت مفيدة؟

المحلول

<rollingStyle value="Once" />

You've got your RollingStyle config set to Once - "Roll files once per program execution" - so if this is a long-runnig service, it will not roll the file. You should instead use Size - "Roll files based only on the size of the file"

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top