Skip to main content

Rotate logs with incremental generation numbers

Project description

JRotateLog

Rotate logs with incremental generation numbers. This is similar to the RotatingFileHandler but instead of max bytes as the rotate condition its when a new python program runs. For every run of the python code rotate the logs with the backed up files indexed start at 0.

Ex. Run python program 3 times creates 2 backups

app.log
app.log.0
app.log.1

backup_count can be used to limit how many logs are kept. Ex. Run python program 4 times with backupCount = 2

app.log   (from run 4)
app.log.0 (from run 3)
app.log.1 (from run 2)
app.log.2 (from run 1, deleted)

Install

pip install jrotatelog

Usage

from jrotatelog.handler import RotateFileHandler

logger = logging.getLogger("app")
fh = RotateFileHandler("app.log")
logger.addHandler(fh)

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

jrotatelog-0.1.0.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

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

jrotatelog-0.1.0-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file jrotatelog-0.1.0.tar.gz.

File metadata

  • Download URL: jrotatelog-0.1.0.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.11.6 Darwin/22.6.0

File hashes

Hashes for jrotatelog-0.1.0.tar.gz
Algorithm Hash digest
SHA256 309aaaaf2580e03ec723f0dfb7e8133e591eff4b26d76ad745b5b768470bb10e
MD5 e178082ae7fc137d25f31f3b34f2bc45
BLAKE2b-256 aed2106164fb6bb977453822460ae304051c1139385d67ffaaf3dc1a102497ee

See more details on using hashes here.

File details

Details for the file jrotatelog-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: jrotatelog-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.11.6 Darwin/22.6.0

File hashes

Hashes for jrotatelog-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a57abc2773c3e9192459cd34ad2bcf2aeafdf11bb4f5ad50ddef89ca09be891b
MD5 94a09c373a7d62a13f1f63f732aba9bf
BLAKE2b-256 21d255487ca5e714f98d5ec5c9a8eb41459b9107ac89f14664096bb2c1400998

See more details on using hashes here.

Supported by

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