mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-16 16:14:28 -04:00
use tempfile when logs dir is not available
This commit is contained in:
parent
3c2f4c95cf
commit
d486f8c162
1 changed files with 7 additions and 1 deletions
|
@ -4,6 +4,7 @@ import os
|
||||||
import sys
|
import sys
|
||||||
import re
|
import re
|
||||||
import logging
|
import logging
|
||||||
|
import tempfile
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from django.utils.crypto import get_random_string
|
from django.utils.crypto import get_random_string
|
||||||
|
@ -248,7 +249,12 @@ class NoisyRequestsFilter(logging.Filter):
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
ERROR_LOG = (LOGS_DIR / 'errors.log') if LOGS_DIR.exists() else '/dev/null'
|
if LOGS_DIR.exists():
|
||||||
|
ERROR_LOG = (LOGS_DIR / 'errors.log')
|
||||||
|
else:
|
||||||
|
# meh too many edge cases here around creating log dir w/ correct permissions
|
||||||
|
# cant be bothered, just trash the log and let them figure it out via stdout/stderr
|
||||||
|
ERROR_LOG = tempfile.NamedTemporaryFile().name
|
||||||
|
|
||||||
LOGGING = {
|
LOGGING = {
|
||||||
'version': 1,
|
'version': 1,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue