[1.5.x] Fixed logging-related test failure introduced by e79b857.

Backport of 654d8e9.