Debug print must be output before redirecting.