limit the number of open files and log when reading a file