Published geoprocessing services write logs that are available at ArcGis Server Manager (arcgis-server/arcgis/manager/log.html)

Arcpy has AddMessage, AddError, etc methods for logging, but they are doesn't works when script is published as geoprocessing service. As I understand, they works only locally in ArcMap.

Is there some way to write server logs from arcpy?

  • 1
    you need to turn the message level on the service itself to INFO | WARNING | ERROR to show applicable arcpy.Add__messages
    – KHibma
    Sep 1, 2015 at 15:51

2 Answers 2


If you use the arcpy.AddMessage(message), it should show up in your published GP, but it shows up on the job messages page (not the server logs as you indicated in your question). You also need to enable this in the service properties (or when you publish the service):

enter image description here


The AddMessage will add a message to the geoprocessing job message queue:
enter image description here


For general logging, I use python logging:
import logging and make sure the formatter has a process id:
formatter = logging.Formatter('%(asctime)s p%(process)s {%(pathname)s:%(lineno)d} %(levelname)s |-| %(message)s')

# Set up logging

logfilepath = os.path.join(tempfile.gettempdir(),'example.log')

logger = logging.getLogger('example_logger')

logger.handlers = []

formatter = logging.Formatter('%(asctime)s p%(process)s {%(pathname)s:%(lineno)d} %(levelname)s |-| %(message)s')
fh = logging.FileHandler(logfilepath)

ch = logging.StreamHandler()

logger.info('example script start...')


logger.debug('Importing ArcPy...')
import arcpy
logger.debug('Importing ArcPy Import Complete')

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.