I want to truncate the changelog, but the function "Change Log Auto Truncate" allows only rows older than 30 days to removed from the changelog. So build my own function where I could decide via a dropdown from how many days back in time the changedate for a logentry should be to be removed from the changelog. For example: if I choose "15" from the dropdown rows with a changedate older than 15 days would be removed from the changelog if nothing else, for example mirroring, that where dependent on that rows in the changelog. The code:
IChangeLog changeLog = (IChangeLog)ClassFactory.CreateInstance(typeof(IChangeLog), newobject 0]);
DateTime oldestChangeDate = DateTime.Now.AddDays(-1*double.Parse(uxNoOfDays.SelectedValue));
I choosed "1" from the dropdown but to my surprise it caused no changes in the changelog: no rows were removed. Why?
Are there so many rows that has a dependency to pages in EPiServer or what? There are almost 9 million rows in the changelog and about 13000 pages in the site. The site does not use mirroring.
I had a simular problem with a site that hadn't turned on changelog truncate and then wanted to. The issue for me was that the sql query timesout because there are so many rows.
So what I did was just to run the sp manualy the first time and then the scheduled work would run as inteded.