You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-dev@logging.apache.org by "Pavel Kilik (JIRA)" <ji...@apache.org> on 2016/06/22 12:38:57 UTC
[jira] [Created] (LOG4NET-519) Number of RollBackups files
extremely increases
Pavel Kilik created LOG4NET-519:
-----------------------------------
Summary: Number of RollBackups files extremely increases
Key: LOG4NET-519
URL: https://issues.apache.org/jira/browse/LOG4NET-519
Project: Log4net
Issue Type: Bug
Affects Versions: 1.2.15
Environment: Win 7
Reporter: Pavel Kilik
Priority: Minor
We have defined LogManager with repositories. In repositories are the RollingFileAppenders. For each RollingFileAppender are defined values:
{code:title=C#, init value settings|borderStyle=solid}
AppendToFile = true;
RollingStyle = RollingFileAppender.RollingMode.Size;
MaxSizeRollBackups = maxFileCount;
MaximumFileSize = maxFileSize;
{code}
It works without problems and number of RollBackups files is equal to MaxSizeRollBackups. If values of MaxSizeRollBackups and MaximumFileSize are runtime changed, the MaxSizeRollBackups is ignored, RollBackups files are not deleted and number of RollBackups files extremely increases. There can be more than 1500 files!!!
RollingFileAppender change in our C# code:
{code:title=C#, runtime value changing|borderStyle=solid}
foreach(var v in LogManager.GetRepository(CreateRepositoryName(id)).GetAppenders())
{
if(v is RollingFileAppender)
{
RollingFileAppender roll = v as RollingFileAppender;
if (roll.MaximumFileSize != filesize)
{
roll.MaximumFileSize = filesize;
}
if (roll.MaxSizeRollBackups != filecount)
{
roll.MaxSizeRollBackups = filecount;
}
}
}
{code}
Part of log4net logging. There are 22 RollBackups, but maxSizeRollBackups is set to 2. The value of maxSizeRollBackups is ignored.
{code:title=log4net logging|borderStyle=solid}
log4net: rolling over count [2058]
log4net: maxSizeRollBackups [2]
log4net: curSizeRollBackups [22]
log4net: countDirection [-1]
log4net: Moving [C:\01_Data\Main\Trunk\KDA\FC\Core\bin\Debug\LogAdapter\11004_L1-AD_NoEquipment.log.22] -> [C:\01_Data\Main\Trunk\KDA\FC\Core\bin\Debug\LogAdapter\11004_L1-AD_NoEquipment.log.23]
log4net: Moving [C:\01_Data\Main\Trunk\KDA\FC\Core\bin\Debug\LogAdapter\11004_L1-AD_NoEquipment.log.21] -> [C:\01_Data\Main\Trunk\KDA\FC\Core\bin\Debug\LogAdapter\11004_L1-AD_NoEquipment.log.22]
{code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)