Only log stack trace when error is not 404.