@ -57,7 +57,7 @@ class FilterPoll(FileFilter):
FileFilter . __init__ ( self , jail )
self . __modified = False
## The time of the last modification of the file.
self . __ lastModTime = dict ( )
self . __ prevStats = dict ( )
self . __file404Cnt = dict ( )
logSys . debug ( " Created FilterPoll " )
@ -67,7 +67,7 @@ class FilterPoll(FileFilter):
# @param path log file path
def _addLogPath ( self , path ) :
self . __ lastModTime[ path ] = 0
self . __ prevStats[ path ] = ( 0 , None , None ) # mtime, ino, size
self . __file404Cnt [ path ] = 0
##
@ -76,7 +76,7 @@ class FilterPoll(FileFilter):
# @param path the log file to delete
def _delLogPath ( self , path ) :
del self . __ lastModTime [ path ]
del self . __ prevStats [ path ]
del self . __file404Cnt [ path ]
##
@ -126,18 +126,20 @@ class FilterPoll(FileFilter):
def isModified ( self , filename ) :
try :
logStats = os . stat ( filename )
stats = logStats . st_mtime , logStats . st_ino , logStats . st_size
pstats = self . __prevStats [ filename ]
self . __file404Cnt [ filename ] = 0
if logSys . getEffectiveLevel ( ) < = 7 :
# we do not want to waste time on strftime etc if not necessary
dt = logStats . st_mtime - self . __lastModTime [ filename ]
logSys . log ( 7 , " Checking %s for being modified. Previous/current mtime s: %s / %s . dt: %s " ,
filename , _ctime( self . __lastModTime [ filename ] ) , _ctime ( logStats . st_mtime ) , dt )
dt = logStats . st_mtime - pstats [ 0 ]
logSys . log ( 7 , " Checking %s for being modified. Previous/current stat s: %s / %s . dt: %s " ,
filename , pstats, stats , dt )
# os.system("stat %s | grep Modify" % filename)
if self . __lastModTime [ filename ] == logStats . st_mtime :
if pstats == stats :
return False
else :
logSys . debug ( filename + " has been modified " )
self . __ lastModTime[ filename ] = logStats . st_mtime
logSys . debug ( " %s has been modified " , filename )
self . __ prevStats[ filename ] = stats
return True
except OSError , e :
logSys . error ( " Unable to get stat on %s because of: %s "