<?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 Notebook - Custom Web Tools logging in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/notebook-custom-web-tools-logging/m-p/1704241#M75250</link>
    <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I'm working on a custom web tool published from a notebook.&amp;nbsp; I'd like to log some geoprocessing messages (Info, Warning, Error) as you would using from a local toolbox using something like arcpy.AddError().&amp;nbsp; These will be displayed to users in an Experience Builder Analysis widget.&lt;/P&gt;&lt;P&gt;The notebook I'm publishing only uses a Standard runtime and I'd like to keep it that way to minimize credit consumption, so arcpy functions aren't available.&amp;nbsp; Is it possible to write geoprocessing messages from a Notebook/Web Tool without arcpy access?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
    <pubDate>Tue, 26 May 2026 05:46:31 GMT</pubDate>
    <dc:creator>MobiusSnake</dc:creator>
    <dc:date>2026-05-26T05:46:31Z</dc:date>
    <item>
      <title>Notebook - Custom Web Tools logging</title>
      <link>https://community.esri.com/t5/python-questions/notebook-custom-web-tools-logging/m-p/1704241#M75250</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I'm working on a custom web tool published from a notebook.&amp;nbsp; I'd like to log some geoprocessing messages (Info, Warning, Error) as you would using from a local toolbox using something like arcpy.AddError().&amp;nbsp; These will be displayed to users in an Experience Builder Analysis widget.&lt;/P&gt;&lt;P&gt;The notebook I'm publishing only uses a Standard runtime and I'd like to keep it that way to minimize credit consumption, so arcpy functions aren't available.&amp;nbsp; Is it possible to write geoprocessing messages from a Notebook/Web Tool without arcpy access?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 26 May 2026 05:46:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/notebook-custom-web-tools-logging/m-p/1704241#M75250</guid>
      <dc:creator>MobiusSnake</dc:creator>
      <dc:date>2026-05-26T05:46:31Z</dc:date>
    </item>
    <item>
      <title>Re: Notebook - Custom Web Tools logging</title>
      <link>https://community.esri.com/t5/python-questions/notebook-custom-web-tools-logging/m-p/1704380#M75251</link>
      <description>&lt;P&gt;Have you tired&amp;nbsp;a custom geoprocessing-style message logger for notebook web tools, something like,&lt;/P&gt;&lt;LI-CODE lang="c"&gt;messages = []

def log_info(msg):
    messages.append(f"[INFO] {msg}")

def log_warning(msg):
    messages.append(f"[WARNING] {msg}")

def log_error(msg):
    messages.append(f"[ERROR] {msg}")

# ... your processing logic ...

log_info("Processing started")
log_warning("Input layer has null geometries — skipping 5 records")
log_error("Output feature class could not be written")

# Output parameter — must match what's defined in the web tool config
output_messages = "\n".join(messages)&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 26 May 2026 16:31:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/notebook-custom-web-tools-logging/m-p/1704380#M75251</guid>
      <dc:creator>TonyAlmeida</dc:creator>
      <dc:date>2026-05-26T16:31:20Z</dc:date>
    </item>
    <item>
      <title>Re: Notebook - Custom Web Tools logging</title>
      <link>https://community.esri.com/t5/python-questions/notebook-custom-web-tools-logging/m-p/1704391#M75252</link>
      <description>&lt;P&gt;The Analysis widget in Experience Builder has a setting that allows you to change the log level between the predefined GP message levels, I'd like to be able to leverage that.&amp;nbsp; I'm assuming that would require the messages to be returned the way they are from a GP service on Server (the "messages" section of the GP Job response), rather than as a string output parameter.&lt;/P&gt;</description>
      <pubDate>Tue, 26 May 2026 17:22:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/notebook-custom-web-tools-logging/m-p/1704391#M75252</guid>
      <dc:creator>MobiusSnake</dc:creator>
      <dc:date>2026-05-26T17:22:40Z</dc:date>
    </item>
    <item>
      <title>Re: Notebook - Custom Web Tools logging</title>
      <link>https://community.esri.com/t5/python-questions/notebook-custom-web-tools-logging/m-p/1704489#M75253</link>
      <description>&lt;P&gt;Have you tried ducking the Messages object? Just write a Message class that has the same attributes and methods that return the same info and see if you can sneak it into the pipeline.&lt;/P&gt;&lt;P&gt;I'm also pretty sure that most server responses use json for messages though, so you could also mock the message schema as seen from the server.&lt;/P&gt;</description>
      <pubDate>Tue, 26 May 2026 22:02:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/notebook-custom-web-tools-logging/m-p/1704489#M75253</guid>
      <dc:creator>HaydenWelch</dc:creator>
      <dc:date>2026-05-26T22:02:35Z</dc:date>
    </item>
    <item>
      <title>Re: Notebook - Custom Web Tools logging</title>
      <link>https://community.esri.com/t5/python-questions/notebook-custom-web-tools-logging/m-p/1704505#M75255</link>
      <description>&lt;P&gt;I think I've figured out how to sneak it in there, but it's&amp;nbsp;&lt;EM&gt;ugly&lt;/EM&gt;:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;When a notebook's run as a web tool, there's an environment variable ENB_JOBID that points to a subdirectory of the /tmp folder (this isn't visible when run as a notebook)&lt;/LI&gt;&lt;LI&gt;This directory contains a logs.txt, which contains a list of dictionaries like this:&lt;/LI&gt;&lt;/UL&gt;&lt;LI-CODE lang="c"&gt;{
  "timestamp": "2026-05-26 22:55:01.432",
  "level": "INFO",
  "message": "Start processing time: 2026-05-26 22:55:01.432811"
}&lt;/LI-CODE&gt;&lt;P&gt;It looks like the contents of that file is what's coming out of my EXB Analysis widget's messages.&lt;/P&gt;&lt;P&gt;On a scale of 0 (nice API call) to 10 (greasy hack) I'd say this falls somewhere around an 7.&lt;/P&gt;&lt;P&gt;Fingers crossed there's a better way.&lt;/P&gt;&lt;P&gt;Edit - I might be overcomplicating this... an unhandled exception will cause an error to be logged, and using warnings.warn() will log an warning.&amp;nbsp; Both include some extra details in the message I don't have control over, but it's pretty close to what I'd like.&lt;/P&gt;</description>
      <pubDate>Tue, 26 May 2026 23:32:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/notebook-custom-web-tools-logging/m-p/1704505#M75255</guid>
      <dc:creator>MobiusSnake</dc:creator>
      <dc:date>2026-05-26T23:32:48Z</dc:date>
    </item>
  </channel>
</rss>

