Had to make logging to file synchronous, as some messages arrived later than others.