Select to view content in your preferred language

ArcGIS Online Notebooks and logging.getLogger() - where is the log?

1750
2
Jump to solution
05-27-2021 11:45 AM
Labels (1)
Wolfgang_Grunberg_AZ_DFFM
Regular Contributor

In ArcGIS Online Notebooks (Standard) how is python logging handled?

  • How do I access the logging.getLogger() log in AGOL Notebooks?
  • Where should the logger point to?
  • Any other best practice suggestions?

Local Notebooks (ArcGIS Pro) has documentation on logging practices but they seem not to apply to the AGOL version. As expected, I have not found any entries in the AGOL Activity Log.

0 Kudos
1 Solution

Accepted Solutions
PeterKnoop
MVP Regular Contributor

If you don't specify a path for your log file, then by default ArcGIS Online Notebooks will log to standard out, and you will see your log messages appear in the output cell. (Note that the default log level is warning, so you will only see log messages in the output cell that are of level warning or higher.)

You can use logging.baseConfig() to specify a file in which to store your logging messages instead. You can also adjust the logging level, if you want to see messages from other levels. For example, 

import logging
logging.basicConfig(
filename = r'/arcgis/home/example.log',
level = logging.DEBUG
)
logging.debug('A DEGBUG log message.')

 

View solution in original post

2 Replies
PeterKnoop
MVP Regular Contributor

If you don't specify a path for your log file, then by default ArcGIS Online Notebooks will log to standard out, and you will see your log messages appear in the output cell. (Note that the default log level is warning, so you will only see log messages in the output cell that are of level warning or higher.)

You can use logging.baseConfig() to specify a file in which to store your logging messages instead. You can also adjust the logging level, if you want to see messages from other levels. For example, 

import logging
logging.basicConfig(
filename = r'/arcgis/home/example.log',
level = logging.DEBUG
)
logging.debug('A DEGBUG log message.')

 

Wolfgang_Grunberg_AZ_DFFM
Regular Contributor

For my fellow neophytes - uploading and downloading files to the AGOL Notebooks workspace:

https://doc.arcgis.com/en/arcgis-online/create-maps/work-with-content-in-a-user-workspace.htm

0 Kudos