I am using python 2.7.3 and Pyinotify 0.9.4 releases with ThreadNotifier. I want to make a tailer on log4j logs. My java application is using log4j RollingFileAppender and creating 3 files in milliseconds. I am watching the log directory and taking actions on these events:
- IN_CREATE - Open the active file a.log
- IN_CLOSE_WRITE - close the active file a.log
- IN_MODIFY - print out the lines
When I got the first IN_CLOSE_WRITE and IN_CREATE events respectively, i assume that the first file is rolled and changed its name to (a.log.1) and a new file is created named a.log but it has already created 3 files like a.log, a.log.1 and a.log.2.
Why do I get pyinotify events very slowly? I can not tail the logs in realtime without thinking its rolling.