added output_file attribute functionality to redirect_output method