Skip to main content

Stackify API for Python

Project description

Stackify API for Python


stackify-python can be installed through pip:

$ pip install -U stackify-api-python

stackify-python-api can be installed through pip:

$ pip install stackify-api-python


Standard API

import stackify
logger = stackify.getLogger(application="Python Application", environment="Production", api_key="***")
logger.warning('Something happened')

Python Logging Integration

import logging
import stackify
logger = logging.getLogger(__name__)
stackify_handler = stackify.StackifyHandler(application="Python Application", environment="Production", api_key="***")
logger.warning('Something happened')

Environment Settings

export STACKIFY_APPLICATION=Python Application
export STACKIFY_API_KEY=******


stackify-python-api handles uploads in batches of 100 messages at a time on another thread. When your program exits, it will shut the thread down and upload the remaining messages.

Stackify can store extra data along with your log message:

    user_string = raw_input("Enter a number: ")
    print("You entered", int(user_string))
except ValueError:
    logger.exception('Bad input', extra={'user entered': user_string})

You can also name your logger instead of using the automatically generated one:

import stackify
logger = stackify.getLogger('mymodule.myfile')

Internal Logger

This library has an internal logger it uses for debugging and messaging. For example, if you want to enable debug messages:

import logging
logger = logging.getLogger('stackify')
logger.addHandler(logging.FileHandler('stackify.log'))  # or any handler you want

By default, it will enable the default logging settings via logging.basicConfig() and print WARNING level messages and above. If you wish to set everything up yourself, just pass basic_config=False in getLogger:

import stackify

logger = stackify.getLogger(basic_config=False)

Django Logging Integration

You can also use your existing django logging and just append stackify logging handler

    'version': 1,
    'disable_existing_loggers': False,
    'handlers': {
        'file': {
            'level': 'DEBUG',
            'class': 'logging.FileHandler',
            'filename': 'debug.log',
        'stackify': {
            'level': 'DEBUG',
            'class': 'stackify.StackifyHandler',
            'application': 'MyApp',
            'environment': 'Dev',
            'api_key': '******',
    'loggers': {
        'django': {
            'handlers': ['file', 'stackify'],
            'level': 'DEBUG',
            'propagate': True,


import logging

logger = logging.getLogger('django')

logger.warning('Something happened')

Real User Monitoring (RUM)

Real user monitoring injects a script tag containing the RUM JS that is responsible for capturing information about the http requests on the browser. This approach is manual and needs to be configured.

RUM - Setup

# Configuration - Standard API
logger = stackify.getLogger(..., rum_key="YourRumKey")
# or Configuration - Python Logging Integration
stackify.StackifyHandler(..., rum_key="YourRumKey")

# Use this to apply on views
import stackify.rum


Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stackify-api-python-1.2.0.tar.gz (21.0 kB view hashes)

Uploaded Source

Built Distribution

stackify_api_python-1.2.0-py3-none-any.whl (28.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page