Handle mutex deadlocks in logger.