I might have figured out the issue: https://issues.apache.org/jira/browse/LOG4NET-291
Regards, Chun Kit p.s. Just joined the mailing list. Thought that replies will be sent to a special email address (so that it'll be put in the same thread), and I didn't (know how to) update the original thread without a reply email. From this email it seems it's threaded simply based on email subject and content. I shouldn't have thought too much. :) On Sun, Apr 10, 2011 at 2:14 PM, Ron Grabowski <rongrabow...@yahoo.com> wrote: > When I change your code to: > for (int i1 = 0; i1 <= 20; i1++) > { > for (int i2 = 0; i2 < 1000; i2++) > { > log.Debug("" + i2 + " " + superLongText); > } > } > the 3 files are created. > The small file size after 20 runs is probably caused because one of the > files is 10mb and the other file has been reset. I'm not sure why that > occurs but it seems like the RFA maintains some sort of internal roll over > state that isn't preserved when the program starts up again. > > ________________________________ > From: Lee Chun Kit <chunki...@gmail.com> > To: log4net-user@logging.apache.org > Sent: Monday, April 4, 2011 5:54 AM > Subject: RollingFileAppender does not seem to preserve old log messages > > Here is the configuration xml I am using: > <log4net debug="true"> > <appender name="RollingLogFileAppender" > type="log4net.Appender.RollingFileAppender"> > <lockingModel type="log4net.Appender.FileAppender+ExclusiveLock" /> > <file value="./output/" /> > <appendToFile value="true" /> > <rollingStyle value="Composite" /> > <datePattern value="'LoggerTest'yyyyMMdd'.log'" /> > <maxSizeRollBackups value="-1" /> > <maximumFileSize value="10MB" /> > <staticLogFileName value="false" /> > <layout type="log4net.Layout.PatternLayout"> > <conversionPattern value="%date [%level] %message%newline" /> > </layout> > </appender> > <logger name="Logger" additivity="false"> > <level value="DEBUG" /> > <appender-ref ref="RollingLogFileAppender" /> > </logger> > </log4net> > --- > Here are the significant portions of my code: > > static readonly string superLongText = new string('a', 1024); > static readonly log4net.ILog log = > log4net.LogManager.GetLogger("Logger"); > > static void Main(string[] args) > { > log4net.Config.XmlConfigurator.Configure("./TestConfig.xml"))); > > for (int i = 0; i < 1000; i++) > { > log.Debug("" + i + " " + superLongText); > } > } > --- > Total size (in bytes) of the generated logs after each execution of my > program: > 01: 1061890 > 02: 2123780 > 03: 3185670 > 04: 4247560 > 05: 5309450 > 06: 6371340 > 07: 7433230 > 08: 8495120 > 09: 9557010 > 10: 10618900 > 11: 11680790 > 12: 12742680 > 13: 13804570 > 14: 14866460 > 15: 15928350 > 16: 16990240 > 17: 18052130 > 18: 19114020 > 19: 20175910 > 20: 10751650 > --- > log files: > LoggerTest20110404.log > LoggerTest20110404.log.1 > --- > After run 19, LoggerTest20110404.log is 9463KB (almost 10MB), and > LoggerTest20110404.log.1 is 10241KB. > After run 20, LoggerTest20110404.log is 260KB, and > LoggerTest20110404.log.1 is 10241KB. However, file > LoggerTest20110404.log.2 is not created (I expect the logger to do > so). > > Does anyone know why is it the case that the log information is not > preserved between run 19 and run 20? May I know if it is an error in > my xml configuration or a limitation of the RollingFileAppender and > the combination of settings I used? > > Thanks. > > Regards, > Chun Kit > > >