jira/apps/api/plane/settings/production.py
vickytechkey a4687eaf39
All checks were successful
Deploy Plane Project Tracker / Deploy to cisystem (push) Successful in 6m47s
feat(logging): add comprehensive server logs for frontend actions and backend API requests
2026-11-06 18:00:17 +05:30

135 lines
4.2 KiB
Python

# Copyright (c) 2023-present Plane Software, Inc. and contributors
# SPDX-License-Identifier: AGPL-3.0-only
# See the LICENSE file for details.
"""Production settings"""
import os
from .common import * # noqa
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = int(os.environ.get("DEBUG", 0)) == 1
# Honor the 'X-Forwarded-Proto' header for request.is_secure()
SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
INSTALLED_APPS += ("scout_apm.django",) # noqa
# Scout Settings
SCOUT_MONITOR = os.environ.get("SCOUT_MONITOR", False)
SCOUT_KEY = os.environ.get("SCOUT_KEY", "")
SCOUT_NAME = "Plane"
LOG_DIR = os.path.join(BASE_DIR, "logs") # noqa
if not os.path.exists(LOG_DIR):
os.makedirs(LOG_DIR)
# Logging configuration
LOGGING = {
"version": 1,
"disable_existing_loggers": True,
"formatters": {
"verbose": {"format": "%(asctime)s [%(process)d] %(levelname)s %(name)s: %(message)s"},
"json": {
"()": "pythonjsonlogger.json.JsonFormatter",
"fmt": "%(levelname)s %(asctime)s %(module)s %(name)s %(message)s",
},
},
"handlers": {
"console": {
"class": "logging.StreamHandler",
"formatter": "json",
"level": "INFO",
},
"requests_file": {
"class": "plane.utils.logging.SizedTimedRotatingFileHandler",
"filename": os.path.join(BASE_DIR, "logs", "plane-requests.log"),
"when": "h",
"maxBytes": 1024 * 1024 * 20,
"interval": 1,
"backupCount": 10,
"formatter": "json",
"level": "INFO",
},
"app_file": {
"class": "plane.utils.logging.SizedTimedRotatingFileHandler",
"filename": os.path.join(BASE_DIR, "logs", "plane-app.log"),
"when": "h",
"maxBytes": 1024 * 1024 * 20,
"interval": 1,
"backupCount": 10,
"formatter": "json",
"level": "INFO",
},
"error_file": {
"class": "plane.utils.logging.SizedTimedRotatingFileHandler",
"filename": os.path.join(BASE_DIR, "logs", "plane-error.log"),
"when": "h",
"maxBytes": 1024 * 1024 * 20,
"interval": 1,
"backupCount": 10,
"formatter": "json",
"level": "WARNING",
},
"client_file": {
"class": "plane.utils.logging.SizedTimedRotatingFileHandler",
"filename": os.path.join(BASE_DIR, "logs", "plane-client.log"),
"when": "h",
"maxBytes": 1024 * 1024 * 20,
"interval": 1,
"backupCount": 10,
"formatter": "json",
"level": "INFO",
},
},
"loggers": {
"plane.client": {
"level": "INFO",
"handlers": ["console", "client_file"],
"propagate": False,
},
"plane.api.request": {
"level": "DEBUG" if DEBUG else "INFO",
"handlers": ["console", "requests_file"],
"propagate": False,
},
"plane.api": {
"level": "DEBUG" if DEBUG else "INFO",
"handlers": ["console", "app_file", "error_file"],
"propagate": False,
},
"plane.worker": {
"level": "DEBUG" if DEBUG else "INFO",
"handlers": ["console", "app_file", "error_file"],
"propagate": False,
},
"plane.exception": {
"level": "DEBUG" if DEBUG else "ERROR",
"handlers": ["console", "error_file"],
"propagate": False,
},
"plane.external": {
"level": "INFO",
"handlers": ["console", "app_file"],
"propagate": False,
},
"plane.authentication": {
"level": "DEBUG" if DEBUG else "INFO",
"handlers": ["console", "app_file", "requests_file"],
"propagate": False,
},
"plane.migrations": {
"level": "DEBUG" if DEBUG else "INFO",
"handlers": ["console", "app_file"],
"propagate": False,
},
"django.request": {
"level": "ERROR",
"handlers": ["console", "error_file"],
"propagate": False,
},
},
}