I'm used to log everything I do in my python scripts to the tool-message window with
like this..
arcpy<SPAN class="punctuation token">.</SPAN>AddMessage<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"!!!!ERROR!!!!, unable to delete existing folder: "</SPAN> <SPAN class="operator token">+</SPAN> fpth<SPAN class="punctuation token">)</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN></SPAN>
At the end of my script I'd like to grab all messages and write them to a textfile at once.
something like:
allmsgs <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>getMessages<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="comment token">#but this only gets the last geoprocessing message</SPAN>
logfile <SPAN class="operator token">=</SPAN> open<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"c:\\temp\mytoollog1.txt"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'w'</SPAN><SPAN class="punctuation token">)</SPAN>
logfile<SPAN class="punctuation token">.</SPAN>write<SPAN class="punctuation token">(</SPAN>allmsgs<SPAN class="punctuation token">)</SPAN>
logfile<SPAN class="punctuation token">.</SPAN>close<SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
Maybe it can be grabbed from the results window?
Thanks