Logging and Output¶
The APPS API uses the Python Logging Framework at various levels to output information helpful for understanding and debugging issues that may affect how APPS is functioning. In addition to Python logging output the Built-in Command Line Interface will print information to directly standard out, bypassing the framework. Information printed to standard out will always pertain the data the command was meant to retrieve or send. APPS logging framework output on the other hand will pertain to under the hood functioning of APPS. For instance, to troubleshoot connectivity issues it may be helpful to enable logging output at the DEBUG level. The different log levels, in order of low to high precedence and the kind of information forwarded to them are as follows:
Level |
Content |
---|---|
DEBUG |
Low level information about state changes in the APPS library. Enable this level if you are having connectivity issues with APPS. |
INFO |
High level information about state changes in the APPS library. |
WARNING |
Information that APPS users should be aware of, but that does not currently prevent the APPS library from functioning. |
ERROR |
Information regarding error conditions that prevent the APPS library from completing specific operations. |
CRITICAL |
Information regarding error conditions that prevent the APPS library from functioning at all. |
OFF |
No output from the logging framework. |
If you enable a logging at a specific level, all information printed to higher levels will also be included in the output. For instance, if you enable at the WARNING level you will see output at ERROR and CRITICAL levels as well.
Named Loggers¶
The following named loggers are part of the APPS library. These hierarchical loggers may be used to more precisely control logging output. The APPS library itself only contains loggers under the gdgps_apps root name, but the library uses several third party libraries, including requests and urllib3 that contain their own loggers.
gdgps_apps
├── apps
│ └── APPS
└── client
├── BaseClient
├── PortalClient
└── ProcessorClient
requests
urllib3
├── connection
├── connectionpool
├── contrib
│ ├── appengine
│ └── pyopenssl
├── poolmanager
├── response
└── util
└── retry
For example, if you wanted to disable all logging from the library but include all logging from the PortalClient you could, while restricting all urllib3 loggers to INFO you could:
import logging
from gdgps_apps.apps import APPS
apps = APPS(log_level='OFF')
logging.getLogger('gdgps_apps.client.PortalClient').setLevel(logging.DEBUG)
logging.getLogger('urllib3').setLevel(logging.INFO)
Routing Logging Output¶
fdadsfasdf a