<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Write logs to a file in ModelBuilder Questions</title>
    <link>https://community.esri.com/t5/modelbuilder-questions/write-logs-to-a-file/m-p/819782#M2024</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can set up a python script to run the model (output goes to stdout)&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="comment token"&gt;# Python script to run model&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ImportToolbox&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;r&lt;SPAN class="string token"&gt;"\\path\foo.tbx"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"bar"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;bar&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;MyModel&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;And launch the python script to run the python script (which runs the model) and capture the output:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;:: bat script to run python script and catch output
echo Model run: %DATE%%TIME% &amp;gt;&amp;gt; D:\logs\mymodel.txt
C:\Python27\ArcGIS10.5\python.exe batchpy.py 2&amp;gt;&amp;amp;1 &amp;gt;&amp;gt; D:\logs\mymodel.txt‍‍‍
:: do next thing when model is done
echo Doing next thing &amp;gt;&amp;gt; D:\logs\mymodel.txt
cmd /c D:\logs\otherthing.bat&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 09:43:07 GMT</pubDate>
    <dc:creator>curtvprice</dc:creator>
    <dc:date>2021-12-12T09:43:07Z</dc:date>
    <item>
      <title>Write logs to a file</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/write-logs-to-a-file/m-p/819781#M2023</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have made a model builder tool. I need to save the logs of this tool in a&amp;nbsp;log file on my D drive of system. Any idea how it can be automated ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Secondly can I call some other windows schedule event once the model is executed ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help or insights will be much appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Akshay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Feb 2018 13:32:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/write-logs-to-a-file/m-p/819781#M2023</guid>
      <dc:creator>akshayloya</dc:creator>
      <dc:date>2018-02-14T13:32:07Z</dc:date>
    </item>
    <item>
      <title>Re: Write logs to a file</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/write-logs-to-a-file/m-p/819782#M2024</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can set up a python script to run the model (output goes to stdout)&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="comment token"&gt;# Python script to run model&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ImportToolbox&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;r&lt;SPAN class="string token"&gt;"\\path\foo.tbx"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"bar"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;bar&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;MyModel&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;And launch the python script to run the python script (which runs the model) and capture the output:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;:: bat script to run python script and catch output
echo Model run: %DATE%%TIME% &amp;gt;&amp;gt; D:\logs\mymodel.txt
C:\Python27\ArcGIS10.5\python.exe batchpy.py 2&amp;gt;&amp;amp;1 &amp;gt;&amp;gt; D:\logs\mymodel.txt‍‍‍
:: do next thing when model is done
echo Doing next thing &amp;gt;&amp;gt; D:\logs\mymodel.txt
cmd /c D:\logs\otherthing.bat&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 09:43:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/write-logs-to-a-file/m-p/819782#M2024</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2021-12-12T09:43:07Z</dc:date>
    </item>
  </channel>
</rss>

