Logging: Automatische Log-Bereinigung nach 7 Tagen implementiert
This commit is contained in:
15
LOGGING.md
15
LOGGING.md
@@ -7,7 +7,8 @@ Das Wordle-Helper Logging-System protokolliert Seitenaufrufe und Suchanfragen oh
|
||||
- **Verzeichnis:** `logs/`
|
||||
- **Datei:** `logs/app.log`
|
||||
- **Format:** UTF-8
|
||||
- **Rotation:** Keine automatische Rotation (manuell oder über externe Tools)
|
||||
- **Rotation:** Automatische Rotation nach 7 Tagen
|
||||
- **Backup:** Komprimierte Backup-Dateien (30 Tage aufbewahrt)
|
||||
- **Verzeichnis:** Wird automatisch erstellt, falls es nicht existiert
|
||||
|
||||
## Protokollierte Ereignisse
|
||||
@@ -50,12 +51,22 @@ logging.basicConfig(
|
||||
level=logging.INFO,
|
||||
format='%(asctime)s - %(levelname)s - %(message)s',
|
||||
handlers=[
|
||||
logging.FileHandler('app.log', encoding='utf-8'),
|
||||
logging.FileHandler(logs_dir / 'app.log', encoding='utf-8'),
|
||||
logging.StreamHandler()
|
||||
]
|
||||
)
|
||||
```
|
||||
|
||||
## Automatische Log-Bereinigung
|
||||
|
||||
Das System bereinigt automatisch alte Log-Dateien:
|
||||
|
||||
- **Rotation:** Nach 7 Tagen wird die aktuelle Log-Datei komprimiert
|
||||
- **Backup:** Komprimierte Dateien werden 30 Tage aufbewahrt
|
||||
- **Format:** Backup-Dateien: `app_YYYYMMDD_HHMMSS.log.gz`
|
||||
- **Trigger:** Bereinigung wird bei jedem Seitenaufruf geprüft
|
||||
- **Fehlerbehandlung:** Fehler bei der Bereinigung werden geloggt
|
||||
|
||||
## Log-Analyse
|
||||
|
||||
Die Log-Datei kann mit Standard-Tools analysiert werden:
|
||||
|
Reference in New Issue
Block a user