Fix seg fault with logging on

Change-Id: I5e0b597e3a46541089fdbc50fb732173996c64e4