Convert string to C-string for logging

Fixes #1245