Fix possible overflow in logging module.