diff options
author | Tim Orling <tim.orling@konsulko.com> | 2023-10-25 07:56:51 -0700 |
---|---|---|
committer | Tim Orling <tim.orling@konsulko.com> | 2023-10-25 07:56:51 -0700 |
commit | 58a87c755aa4bd0146fe4ec2fcf2c005e8b0be7d (patch) | |
tree | 624c45214f893311a0c8cd4c630101be20e86a56 | |
parent | f20e3f4a05e88a6c1ae0a096da0e024fb6dfb25b (diff) | |
download | bitbake-contrib-timo/toaster-logging.tar.gz |
toastermain: try BUILDDIR for loggingtimo/toaster-logging
Signed-off-by: Tim Orling <tim.orling@konsulko.com>
-rw-r--r-- | lib/toaster/toastermain/logs.py | 9 | ||||
-rw-r--r-- | lib/toaster/toastermain/settings.py | 4 |
2 files changed, 7 insertions, 6 deletions
diff --git a/lib/toaster/toastermain/logs.py b/lib/toaster/toastermain/logs.py index b4910e443..711796017 100644 --- a/lib/toaster/toastermain/logs.py +++ b/lib/toaster/toastermain/logs.py @@ -6,7 +6,8 @@ import json from pathlib import Path from django.http import HttpRequest -BASE_DIR = Path(__file__).resolve(strict=True).parent.parent +#BASE_DIR = Path(__file__).resolve(strict=True).parent.parent +BUILDDIR = os.environ['BUILDDIR'] def log_api_request(request, response, view, logger_name='api'): @@ -108,7 +109,7 @@ LOGGING_SETTINGS = { 'file_django': { 'level': 'INFO', 'class': 'logging.handlers.TimedRotatingFileHandler', - 'filename': BASE_DIR / 'logs/django.log', + 'filename': BUILDDIR / 'logs/django.log', 'when': 'D', # interval type 'interval': 1, # defaults to 1 'backupCount': 10, # how many files to keep @@ -117,7 +118,7 @@ LOGGING_SETTINGS = { 'file_api': { 'level': 'INFO', 'class': 'logging.handlers.TimedRotatingFileHandler', - 'filename': BASE_DIR / 'logs/api.log', + 'filename': BUILDDIR / 'logs/api.log', 'when': 'D', 'interval': 1, 'backupCount': 10, @@ -126,7 +127,7 @@ LOGGING_SETTINGS = { 'file_toaster': { 'level': 'INFO', 'class': 'logging.handlers.TimedRotatingFileHandler', - 'filename': BASE_DIR / 'logs/toaster.log', + 'filename': BUILDDIR / 'logs/toaster.log', 'when': 'D', 'interval': 1, 'backupCount': 10, diff --git a/lib/toaster/toastermain/settings.py b/lib/toaster/toastermain/settings.py index b083cf588..dcd81b6d6 100644 --- a/lib/toaster/toastermain/settings.py +++ b/lib/toaster/toastermain/settings.py @@ -316,12 +316,12 @@ for t in os.walk(os.path.dirname(currentdir)): LOGGING = LOGGING_SETTINGS # Build paths inside the project like this: BASE_DIR / 'subdir'. -BASE_DIR = Path(__file__).resolve(strict=True).parent.parent +#BASE_DIR = Path(__file__).resolve(strict=True).parent.parent # LOG VIEWER # https://pypi.org/project/django-log-viewer/ LOG_VIEWER_FILES_PATTERN = '*.log*' -LOG_VIEWER_FILES_DIR = os.path.join(BASE_DIR, 'logs') +LOG_VIEWER_FILES_DIR = os.path.join(os.envion['BUILDDIR'], 'logs') LOG_VIEWER_PAGE_LENGTH = 25 # total log lines per-page LOG_VIEWER_MAX_READ_LINES = 100000 # total log lines will be read LOG_VIEWER_PATTERNS = ['INFO', 'DEBUG', 'WARNING', 'ERROR', 'CRITICAL'] |