Log command exceptions properly