Also make getmtime() calls more robust by retrying multiple times
before giving up.
Setup logging on module level.