16 - Centralized Logging
Overview
Architecture Diagram
┌──────────────────────────────────────────────────────────────────────────────┐
│ Centralized Logging Architecture │
└──────────────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────────────┐
│ Application Components │
│ │
│ ┌────────────┐ ┌────────────┐ ┌────────────┐ ┌────────────┐ │
│ │ Flask │ │ REST API │ │ WebSocket │ │ Services │ │
│ │ Routes │ │ Endpoints │ │ Proxy │ │ │ │
│ └─────┬──────┘ └─────┬──────┘ └─────┬──────┘ └─────┬──────┘ │
│ │ │ │ │ │
│ └───────────────┴───────────────┴───────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────┐ │
│ │ get_logger() │ │
│ │ (utils/logging)│ │
│ └────────┬────────┘ │
└───────────────────────────────────┼─────────────────────────────────────────┘
│
┌───────────────┴───────────────┐
│ │
▼ ▼
┌────────────────────────────┐ ┌────────────────────────────┐
│ Console Handler │ │ File Handler │
│ │ │ (if LOG_TO_FILE=True) │
│ - Colored output │ │ │
│ - Level-based formatting │ │ - Rotating files │
│ - Immediate display │ │ - Configurable retention │
└────────────────────────────┘ └────────────────────────────┘
│
▼
┌────────────────────────────┐
│ log/ directory │
│ │
│ - openalgo.log │
│ - openalgo.log.1 │
│ - openalgo.log.2 │
└────────────────────────────┘Configuration
Environment Variables
Usage
Getting a Logger
Log Levels
Level
Value
Use Case
Implementation
Log Categories
Application Logs
Category
Logger Name
Description
Example Log Output
Startup Banner
File Rotation
Rotation Settings
Setting
Default
Description
Viewing Logs
File Logs
UI Log Viewer
Key Files Reference
File
Purpose
Last updated