<?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 Log file not being written to when executing from bat in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/log-file-not-being-written-to-when-executing-from/m-p/1154262#M64075</link>
    <description>&lt;P&gt;We have our python script ready to be scheduled nightly to refresh our legacy parcels feature class from the fabric.&amp;nbsp; Preparing the script to be run from windows task scheduler I created a simple .bat file that calls the python exe and passes the script.&lt;/P&gt;&lt;P&gt;"C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\python.exe"&amp;nbsp;"\\path to script\script.py&lt;/P&gt;&lt;P&gt;This morning I ran the script by double clicking the .bat file. The messages appeared in the command window leading me to believe that the log file would be updated.&lt;/P&gt;&lt;P&gt;The .py script uses logging library:&lt;/P&gt;&lt;P&gt;logging.basicConfig(filename='parcelsync.log', level=logging.DEBUG)&lt;/P&gt;&lt;P&gt;# Start Time&lt;BR /&gt;print ("\nStart Time: {}".format(StartTime))&lt;BR /&gt;logging.info("\nStart Time: {}".format(StartTime))&lt;/P&gt;&lt;P&gt;After the script completed I noticed that the log file hadn't been updated but the script did update the features.&lt;/P&gt;&lt;P&gt;What am I missing?&lt;/P&gt;&lt;P&gt;I tried searching the web for an explanation and I can't come close to finding a relevant result &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;As always, help is greatly appreciated.&lt;/P&gt;</description>
    <pubDate>Wed, 16 Mar 2022 14:02:04 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2022-03-16T14:02:04Z</dc:date>
    <item>
      <title>Log file not being written to when executing from bat</title>
      <link>https://community.esri.com/t5/python-questions/log-file-not-being-written-to-when-executing-from/m-p/1154262#M64075</link>
      <description>&lt;P&gt;We have our python script ready to be scheduled nightly to refresh our legacy parcels feature class from the fabric.&amp;nbsp; Preparing the script to be run from windows task scheduler I created a simple .bat file that calls the python exe and passes the script.&lt;/P&gt;&lt;P&gt;"C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\python.exe"&amp;nbsp;"\\path to script\script.py&lt;/P&gt;&lt;P&gt;This morning I ran the script by double clicking the .bat file. The messages appeared in the command window leading me to believe that the log file would be updated.&lt;/P&gt;&lt;P&gt;The .py script uses logging library:&lt;/P&gt;&lt;P&gt;logging.basicConfig(filename='parcelsync.log', level=logging.DEBUG)&lt;/P&gt;&lt;P&gt;# Start Time&lt;BR /&gt;print ("\nStart Time: {}".format(StartTime))&lt;BR /&gt;logging.info("\nStart Time: {}".format(StartTime))&lt;/P&gt;&lt;P&gt;After the script completed I noticed that the log file hadn't been updated but the script did update the features.&lt;/P&gt;&lt;P&gt;What am I missing?&lt;/P&gt;&lt;P&gt;I tried searching the web for an explanation and I can't come close to finding a relevant result &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;As always, help is greatly appreciated.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Mar 2022 14:02:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/log-file-not-being-written-to-when-executing-from/m-p/1154262#M64075</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2022-03-16T14:02:04Z</dc:date>
    </item>
    <item>
      <title>Re: Log file not being written to when executing from bat</title>
      <link>https://community.esri.com/t5/python-questions/log-file-not-being-written-to-when-executing-from/m-p/1154267#M64076</link>
      <description>&lt;P&gt;Perhaps the log file is ending up in a different directory. Try to specify the full log file path in the call to basicConfig to see if that helps.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Mar 2022 14:12:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/log-file-not-being-written-to-when-executing-from/m-p/1154267#M64076</guid>
      <dc:creator>DonMorrison1</dc:creator>
      <dc:date>2022-03-16T14:12:45Z</dc:date>
    </item>
    <item>
      <title>Re: Log file not being written to when executing from bat</title>
      <link>https://community.esri.com/t5/python-questions/log-file-not-being-written-to-when-executing-from/m-p/1154274#M64077</link>
      <description>&lt;P&gt;You are correct! It was writing to the location of the bat file and not the python file which I had in a different location. Thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Mar 2022 14:16:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/log-file-not-being-written-to-when-executing-from/m-p/1154274#M64077</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2022-03-16T14:16:20Z</dc:date>
    </item>
    <item>
      <title>Re: Log file not being written to when executing from bat</title>
      <link>https://community.esri.com/t5/python-questions/log-file-not-being-written-to-when-executing-from/m-p/1154286#M64078</link>
      <description>&lt;P&gt;As Don said, you could put the full path to the log file in the &lt;EM&gt;filename= &lt;/EM&gt;parameter.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;out = r'C:\Python Scripts\Logfiles\log.txt'
logging.basicConfig(filename=out,level=logging.DEBUG)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Mar 2022 14:40:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/log-file-not-being-written-to-when-executing-from/m-p/1154286#M64078</guid>
      <dc:creator>JaredPilbeam2</dc:creator>
      <dc:date>2022-03-16T14:40:42Z</dc:date>
    </item>
  </channel>
</rss>

