[Twisted-Python] Log rotates not as expected

Lucas Taylor ltaylor.volks at gmail.com
Thu Jan 21 12:50:23 EST 2010


On 1/20/10 5:35 AM, Pet wrote:
> Hi,
> 
> in code below I try to rotate log files if they reach 5000000 limit,
> but this happens only to every 5 files, ls -althr:
> 
> -rw-r--r-- 1 root root 977K 2010-01-19 19:03 /var/log/my.log.12
> -rw-r--r-- 1 root root 977K 2010-01-19 19:55 /var/log/my.log.10
> -rw-r--r-- 1 root root 977K 2010-01-19 20:41 /var/log/my.log.9
> -rw-r--r-- 1 root root 977K 2010-01-19 21:30 /var/log/my.log.8
> -rw-r--r-- 1 root root 977K 2010-01-19 22:46 /var/log/my.log.7
> -rw-r--r-- 1 root root 4.8M 2010-01-20 00:19 /var/log/my.log.11
> -rw-r--r-- 1 root root 977K 2010-01-20 00:19 /var/log/my.log.6
> -rw-r--r-- 1 root root 977K 2010-01-20 09:17 /var/log/my.log.4
> -rw-r--r-- 1 root root 977K 2010-01-20 10:45 /var/log/my.log.3
> -rw-r--r-- 1 root root 977K 2010-01-20 12:04 /var/log/my.log.2
> -rw-r--r-- 1 root root 977K 2010-01-20 12:59 /var/log/my.log.1
> -rw-r--r-- 1 root root 4.2M 2010-01-20 13:26 /var/log/my.log.5
> -rw-r--r-- 1 root root 301K 2010-01-20 13:26 /var/log/my.log
> 
> 
> it writes simultaneously to both my.log.5 and my.log. It is not big
> problem, but in this way I have only recent files, because they grows
> quickly
> 
> Pet
> 
<snip>

This can occur if you have multiple instances of logfile.LogFile setup
to manage the same file. The default rotation is 1MB, so maybe you have
another logfile.LogFile somewhere?



More information about the Twisted-Python mailing list