Geoprocessing from command window : how to generate a log file?

Discussion created by piotrlacroix@yahoo.fr on Sep 9, 2013
Latest reply on Sep 10, 2013 by curtvprice
Hi ,

I have executed a simple PY script from the CMD window:

# -*- coding: utf-8 -*-
import arcpy, sys
arcpy.AddWarning("............... Does this message appear in the logfile?")

The execution is successfull. However no log file was created in C:\Users\<My name>\AppData\Roaming\ESRI\Desktop10.1\ArcToolbox\History as it is the case when executing from ArcToolBox.
My question is then: how can I create a log file automatically (I mean: without opening/closing a text file from Python)?

Thanks for your answer.