trim leading spaces, debug logging