Fix logging performance problem.