Skip to content

Commit

Permalink
Write logs into log file (fsr-de#307)
Browse files Browse the repository at this point in the history
  • Loading branch information
frcroth authored and SilvanVerhoeven committed Feb 13, 2024
1 parent df2620d commit 0e83b11
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,5 @@ cython_debug/

bootstrap/
bootstrap.bundle.min.js*
tmp/
tmp/
logs/
11 changes: 11 additions & 0 deletions myhpi/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,10 @@
SERVER_EMAIL = env.str("SERVER_EMAIL")
ADMINS = getaddresses([env("ADMINS")])

LOG_DIR = os.path.join(BASE_DIR, "logs")
if not os.path.exists(LOG_DIR):
os.makedirs(LOG_DIR)

# logging
LOGGING = {
"version": 1,
Expand All @@ -325,6 +329,13 @@
"class": "logging.StreamHandler",
"formatter": "default",
},
"file": {
"level": "WARNING",
"class": "logging.handlers.RotatingFileHandler",
"filename": os.path.join(LOG_DIR, "debug.log"),
"backupCount": 10,
"maxBytes": 5242880,
},
},
"loggers": {
"django": {
Expand Down

0 comments on commit 0e83b11

Please sign in to comment.