Skip to main content

OCI Log Handler

A buffered Python logging handler that sends application logs to Oracle Cloud Infrastructure Logging by using the OCI Python SDK Logging Ingestion client.

Requires Python 3.11 or later.

Installation

pip install oci-log-handler

Usage

import logging

import oci
from oci_log_handler import OciLoggingHandler

config = oci.config.from_file()

handler = OciLoggingHandler(
    log_ocid="ocid1.log.oc1..example",
    config=config,
    capacity=100,
)
handler.setFormatter(logging.Formatter("%(levelname)s:%(name)s:%(message)s"))

logger = logging.getLogger("my-app")
logger.setLevel(logging.INFO)
logger.addHandler(handler)

logger.info("Application started")

You can also pass an existing OCI Logging Ingestion client:

import logging

import oci
from oci import loggingingestion
from oci_log_handler import OciLoggingHandler

config = oci.config.from_file()
client = loggingingestion.LoggingClient(config)

handler = OciLoggingHandler(
    log_ocid="ocid1.log.oc1..example",
    client=client,
    capacity=100,
)

logger = logging.getLogger("my-app")
logger.addHandler(handler)

For signer-based authentication, pass signer= when constructing the handler or create the LoggingClient with your signer and pass it as client=.

Delivery behavior

This handler is best-effort and keeps its retry buffer in memory. By default, failed submissions are restored to the handler's bounded buffer and do not raise exceptions into the application. If the process exits before a later successful flush, those buffered records are not durable.

Pass raise_exceptions=True if your application should fail fast when OCI submission fails.

Download files

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

Source Distribution

oci_log_handler-0.1.1.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

oci_log_handler-0.1.1-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file oci_log_handler-0.1.1.tar.gz.

File metadata

  • Download URL: oci_log_handler-0.1.1.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.11.11

File hashes

Hashes for oci_log_handler-0.1.1.tar.gz
Algorithm Hash digest
SHA256 6b0e528731b3761a16c109532fc94d212e5451f95c3a2903d526b6dad27cdd01
MD5 7411c9665f054e48a4c5c96d1265a3eb
BLAKE2b-256 3c6790cbd2fec046760f4d584c36696353dd2727f5bed3c917f0ea6babaad443

See more details on using hashes here.

File details

Details for the file oci_log_handler-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for oci_log_handler-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c08da3c4a8f8a48a729d01cdbedc11e2e746076e2670481fb941a46f8d7453d1
MD5 b7a8db9562c6ecebe15a9b2ecd06e89e
BLAKE2b-256 91bf8ee89776601973d094e2a64700969e5a5447cdd2fb7560acaee087bf56cd

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.2

2 files

This release

0.1.1 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page