0

Please read through question before marking it as duplicate. I have gone through the links in this forum but could not find the solution working.

Please refer to my configurtion below

<log4net>
<appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">
  <file type="log4net.Util.PatternString" value="${ALLUSERSPROFILE}\FileManager\Logs\Log_" />
  <appendToFile value="true" />
  <rollingStyle value="Date" />
  <datePattern value="MMddyyyy'.log'" />
  <staticLogFileName value="false" />
  <preserveLogFileNameExtension value="true" />
  <maxSizeRollBackups value="3" />
  <layout type="log4net.Layout.PatternLayout">
    <conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] – %message%newline" />
  </layout>
</appender>
<root>
  <level value="ALL"/>
  <appender-ref ref="RollingFileAppender"/>
</root>
<logger>
  <level />
  <appender-ref />
</logger>

I ran my application for more than 3 days but it didn't remove old log files. My screenshot of logs

enter image description here

Community
  • 1
  • 1
techspider
  • 3,370
  • 13
  • 37
  • 61
  • This is a known (unresolved) issue. See also [this](http://stackoverflow.com/questions/95286/log4net-set-max-backup-files-on-rollingfileappender-with-rolling-date) and [this](http://stackoverflow.com/questions/4259795/can-log4net-delete-log-files-automatically) SO post. – Wicher Visser Apr 18 '16 at 14:53
  • 1
    @CodeCaster, I believe marking a question duplicate with a solution provided 6 years ago is not a correct approach; From this action, it implies that users are restricted from asking questions that may otherwise be possible with new versions in the industry or latest approaches; – techspider Apr 18 '16 at 14:58
  • 1
    @techspider on the other hand, we also don't need yearly _"Is this still broken?"_ - _"Yes"_ Q&As. If you disagree, feel free to start a discussion on [meta] (but not before searching). The point is: the answer in the duplicate is still valid, but because the same question gets asked and answered (incorrectly) over and over again, it becomes impossible to find the actual answer. – CodeCaster Apr 18 '16 at 15:07
  • @CodeCaster, which namespace has LogManager in that code? I have my own LogManager class and not able to find in Log4net namespaces – techspider Apr 20 '16 at 14:16
  • 1
    [`log4net.LogManager`](https://logging.apache.org/log4net/release/sdk/html/M_log4net_LogManager_GetLogger_2.htm) – CodeCaster Apr 20 '16 at 14:18

0 Answers0