Skip to content

Commit

Permalink
Merge pull request #334 from Healthlane-Technologies/logging_and_tele…
Browse files Browse the repository at this point in the history
…metry

fix: shift handler and logger inside setup_setting
  • Loading branch information
shahharsh176 authored Aug 2, 2024
2 parents 52ab7ff + 3d30e9c commit ce7b214
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions backend/src/zango/config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,24 +226,12 @@
}
},
"handlers": {
"file": {
"level": "INFO",
"class": "logging.handlers.RotatingFileHandler",
"maxBytes": 1024 * 1024 * 5, # 5 MB
"formatter": "verbose", # Use the custom formatter
"filters": ["tenant_filter"],
},
"console": {
"class": "logging.StreamHandler",
"formatter": "console",
},
},
"loggers": {
"django": {
"handlers": ["file"],
"level": "DEBUG",
"propagate": True,
},
"django.db.backends": {
"handlers": ["console"],
"level": "ERROR",
Expand Down Expand Up @@ -415,8 +403,19 @@ def setup_settings(settings, BASE_DIR):
with open(log_file, "a"):
pass # Create an empty file

LOGGING["handlers"]["file"]["filename"] = log_file

settings.LOGGING["handlers"]["file"] = {
"level": "INFO",
"class": "logging.handlers.RotatingFileHandler",
"filename": log_file,
"maxBytes": 1024 * 1024 * 5, # 5 MB
"formatter": "verbose", # Use the custom formatter
"filters": ["tenant_filter"],
}
settings.LOGGING["loggers"]["django"] = {
"handlers": ["file"],
"level": "DEBUG",
"propagate": True,
}
# OTEL Settings
settings.OTEL_IS_ENABLED = env("OTEL_IS_ENABLED")
settings.OTEL_EXPORT_TO_OTLP = env("OTEL_EXPORT_TO_OTLP")
Expand Down

0 comments on commit ce7b214

Please sign in to comment.