I am working on setting up RollingFileAppender in log4net programmatically. I currently have something like this:
RollingFileAppender fa = new RollingFileAppender();
fa.AppendToFile = true;
fa.RollingStyle = RollingFileAppender.RollingMode.Date;
fa.DatePattern = "yyyyMMdd";
fa.StaticLogFileName = true;
This refuses to collapse the journal depending on the date. If I switch the RollingStyle to Size or Composite, it will be collapsed, but only the size is based, not based on the date. I tried removing StaticLogFileName and playing with DatePattern to no avail.
I need to configure this programmatically since I don’t know the number of additions at runtime, so setting it up with XML, which I was able to get in the past, is not-go. Does anyone have any idea? Am I missing something?
source
share