Scout APM Python Logging Agent
A Python package for detailed, easy-to-navigate, managed log monitoring. Sign up for an account at https://www.scoutapm.com to start monitoring your logs and application performance in minutes.
This is to be used alongside scout-apm-python package, thusly requires it.
To use Scout, you'll need to sign up for an account or use our Heroku Addon.
Then, you'll need to enable logging for your individual apps, which will provide a SCOUT_LOGS_INGEST_KEY
Installation
Install the Scout APM Python Logging Agent using pip:
pip install scout-apm-python-logging
Setup and Usage
Using dictConfig
We recommend setting up the ScoutOtelHandler using Python's dictConfig. Here's an example configuration:
import logging
from logging.config import dictConfig
from scout_apm_logging import ScoutOtelHandler
LOGGING_CONFIG = {
"version": 1,
"disable_existing_loggers": False,
"formatters": {
"standard": {
"format": "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
},
},
"handlers": {
"otel": {
"level": "DEBUG",
"class": "scout_apm_logging.ScoutOtelHandler",
"service_name": "your-service-name",
},
"console": {
"level": "DEBUG",
"class": "logging.StreamHandler",
"formatter": "standard",
},
},
"loggers": {
"": { # Root logger
"handlers": ["console", "otel"],
"level": "DEBUG",
},
},
}
# Apply the logging configuration
dictConfig(LOGGING_CONFIG)
Adding to an Existing Logger
You can also add the ScoutOtelHandler to an existing logger:
import logging
from scout_apm_logging import ScoutOtelHandler
# Get your logger
logger = logging.getLogger(__name__)
# Create and add the ScoutOtelHandler
handler = ScoutOtelHandler(service_name="your-service-name")
logger.addHandler(handler)
Alternative logging configurations are covered in our documentation
Configuration
The ScoutOtelHandler only requires service_name to be supplied to the handler as an argument:
If the scout-apm is configured (You've set your SCOUT_KEY, etc), you'll only need add your SCOUT_LOGS_INGEST_KEY to whichever configuration you are already using. This can also be set as an environment variable.
Make sure to set the SCOUT_LOGS_INGEST_KEY variable in the above configuration before running your application.
OpenTelemetry
The Scout APM Python Logging Agent leverages OpenTelemetry Python to provide powerful and standardized logging capabilities. OpenTelemetry is an observability framework for cloud-native software, offering a collection of tools, APIs, and SDKs for generating, collecting, and exporting telemetry data (metrics, logs, and traces).
Our ScoutOtelHandler utilizes the OpenTelemetry Python SDK to:
- Create a
LoggerProviderwith a custom resource that includes your service name and instance ID. - Set up an OTLP (OpenTelemetry Protocol) exporter configured to send logs to Scout's ingestion endpoint.
- Add a
BatchLogRecordProcessorto efficiently process and export log records. - Integrate with Scout APM's request tracking to enrich logs with request-specific information.
This integration allows you to benefit from OpenTelemetry's standardized approach to observability while leveraging Scout APM's powerful analysis and visualization tools.
For more information about OpenTelemetry and its Python SDK, visit the OpenTelemetry Python documentation.
Additional Resources
For more information on using Scout APM and advanced configuration options, please refer to our documentation.
Support
If you encounter any issues or have questions, please open an issue on our GitHub repository or contact our support team at support@scoutapm.com.
Metadata
Release files for scout-apm-logging 1.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| scout_apm_logging-1.0.4.tar.gz | 4.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| scout_apm_logging-1.0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.6 kB
Release files / scout_apm_logging-1.0.4.tar.gz
| Download URL | scout_apm_logging-1.0.4.tar.gz |
|---|---|
| Size | 4.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9e0b6fbcaa7fdf14d0f902b50c496f2c7774d8343fd5d9b7635feffb2cfb0d42
|
|
BLAKE2b-256 checksum How to use checksums |
d5139a8fcda04495a5b22742e8dde44ae505601e02946f3048535f9d5552c60e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 9, 2026.
Transparency logRelease files / scout_apm_logging-1.0.4-py3-none-any.whl
| Download URL | scout_apm_logging-1.0.4-py3-none-any.whl |
|---|---|
| Size | 5.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
17bb3003c87b2a0b1837f94b8e4e1dd8bd9f47c47ffbf37b6a3d1da14b217876
|
|
BLAKE2b-256 checksum How to use checksums |
f2020e2cf3ee2d9fc07d6768e28fd52e19d0e8e168d32d1232b0d2c550388f83
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 9, 2026.
Transparency log