Fix logger deadlock situation when log file is rotated