# Logging Monitoring

> Configuring Python logging library, formatting streams, and managing rotating logs.

- Skill: `lord1egypt/logging-monitoring-2` (Agent Skill)
- Install (CLI): `npx skillmds@latest add lord1egypt/logging-monitoring-2`
- Raw SKILL.md: https://api.skillmd.com/api/skills/lord1egypt/logging-monitoring-2/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- License: MIT license
- Author: Lord1Egypt (https://skillmd.com/u/lord1egypt)
- Updated: 2026-09-21
- Page: https://skillmd.com/skills/lord1egypt/logging-monitoring-2

---


# Logging Monitoring

## Overview
Logging provides diagnostic tracking systems in software, helping debug runtime issues without cluttering stdout.

## When to Use This Skill
Use to log request statuses, background operations, and track crashes systematically inside files.

## Quick Start (with runnable code examples)

```python
import logging
from logging.handlers import RotatingFileHandler

# Set up log formatter
log_fmt = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s')

# Set up rotating log files (max 1MB, keeping 3 backups)
handler = RotatingFileHandler("app.log", maxBytes=1000000, backupCount=3)
handler.setFormatter(log_fmt)

logger = logging.getLogger("AppLogger")
logger.setLevel(logging.INFO)
logger.addHandler(handler)

logger.info("Application successfully initialized.")
```

## Advanced Usage
Set up multi-logger inheritance tree, log exception traces automatically using `logger.exception()`, and configure central diagnostic systems.

## Key References
- [Python logging documentation](https://docs.python.org/3/library/logging.html)

## Dependencies
- Python Standard Library

