forked from Fediversity/Fediversity
log to file
This commit is contained in:
parent
f87275e384
commit
1a8d940a90
4 changed files with 12 additions and 1 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -12,3 +12,4 @@ result*
|
||||||
*screenshot.png
|
*screenshot.png
|
||||||
output
|
output
|
||||||
todo
|
todo
|
||||||
|
log/
|
||||||
|
|
|
@ -31,6 +31,7 @@ in
|
||||||
DATABASE_URL = "sqlite:///${toString ./src}/db.sqlite3";
|
DATABASE_URL = "sqlite:///${toString ./src}/db.sqlite3";
|
||||||
# locally: use a fixed relative reference, so we can use our newest files without copying to the store
|
# locally: use a fixed relative reference, so we can use our newest files without copying to the store
|
||||||
REPO_DIR = toString ../.;
|
REPO_DIR = toString ../.;
|
||||||
|
LOGGING_DIR = "../log";
|
||||||
};
|
};
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
ln -sf ${sources.htmx}/dist/htmx.js src/panel/static/htmx.min.js
|
ln -sf ${sources.htmx}/dist/htmx.js src/panel/static/htmx.min.js
|
||||||
|
|
|
@ -30,6 +30,7 @@ let
|
||||||
(builtins.toFile "extra-settings.py" cfg.extra-settings)
|
(builtins.toFile "extra-settings.py" cfg.extra-settings)
|
||||||
];
|
];
|
||||||
REPO_DIR = import ../../launch/tf-env.nix { inherit lib pkgs; };
|
REPO_DIR = import ../../launch/tf-env.nix { inherit lib pkgs; };
|
||||||
|
LOGGING_DIR = "/var/log/${name}";
|
||||||
};
|
};
|
||||||
|
|
||||||
python-environment = pkgs.python3.withPackages (
|
python-environment = pkgs.python3.withPackages (
|
||||||
|
|
|
@ -175,6 +175,9 @@ COMPRESS_PRECOMPILERS = [
|
||||||
|
|
||||||
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||||
|
|
||||||
|
logging_dir = env["LOGGING_DIR"]
|
||||||
|
os.makedirs(logging_dir, mode=0o700, exist_ok=True)
|
||||||
|
|
||||||
LOGGING = {
|
LOGGING = {
|
||||||
"version": 1,
|
"version": 1,
|
||||||
"disable_existing_loggers": False,
|
"disable_existing_loggers": False,
|
||||||
|
@ -209,10 +212,15 @@ LOGGING = {
|
||||||
"filters": ["require_debug_false"],
|
"filters": ["require_debug_false"],
|
||||||
"class": "django.utils.log.AdminEmailHandler",
|
"class": "django.utils.log.AdminEmailHandler",
|
||||||
},
|
},
|
||||||
|
"file": {
|
||||||
|
"level": "INFO",
|
||||||
|
"class": "logging.FileHandler",
|
||||||
|
"filename": f"{logging_dir}/info.log",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
"loggers": {
|
"loggers": {
|
||||||
"django": {
|
"django": {
|
||||||
"handlers": ["console", "mail_admins"],
|
"handlers": ["console", "mail_admins", "file"],
|
||||||
"level": "INFO",
|
"level": "INFO",
|
||||||
},
|
},
|
||||||
"django.server": {
|
"django.server": {
|
||||||
|
|
Loading…
Add table
Reference in a new issue