diff options
author | Alassane Yattara <alassane.yattara@savoirfairelinux.com> | 2023-10-27 01:36:30 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-10-27 08:32:29 +0100 |
commit | 7e0cce4f6b754e33a0652b516d622b6b40b3abd7 (patch) | |
tree | 70c1a56a25d68a77aa17f429085007c127f08aba /bitbake/lib/toaster/toastermain/settings.py | |
parent | 6c43e8403203805fa23171be80deb7717def034a (diff) | |
download | poky-7e0cce4f6b754e33a0652b516d622b6b40b3abd7.tar.gz |
bitbake: toaster: Write logs to BUILDDIR/toaster_logs
Fixes "2efb14648 toaster: Monitoring - implement Django logging system" when
running in a container.
When running in a container, the previous approach of using BASE_DIR
is not a writable path. Also, we really do not want to be writing logs into
the source tree, as the BASE_DIR was resolving to bitbake/lib/toaster/logs
Since Toaster is only ever running in an environment where oe-init-buildenv
or similar has been sourced, we should instead write the logs to BUILDDIR.
Using BUILDDIR to logs make path writable but django-log-viewer does'nt manage
to write logs using an absolute path as BUILDDIR, where the existing toaster_ui.log
was already being written.
Also drop the /logs/ directory, as it has not been created which also breaks
in a container environment
To handle the constraints linked to django-log-viewer and /logs/, we've updated
bitbake/bin/toaster to create a toaster_logs/ directory in BUILDDIR if it doesn't exist,
when toaster starts up.
Also manage to set BUILDDIR/toaster_logs/ as default location for toaster logs.
(Bitbake rev: efbd9d54f57be7a7a10f0b56e7e62c25974e99e6)
Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
Signed-off-by: Tim Orling <tim.orling@konsulko.com>
Tested-by: Tim Orling <tim.orling@konsulko.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/toastermain/settings.py')
-rw-r--r-- | bitbake/lib/toaster/toastermain/settings.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/bitbake/lib/toaster/toastermain/settings.py b/bitbake/lib/toaster/toastermain/settings.py index b083cf5885..5de881c4bb 100644 --- a/bitbake/lib/toaster/toastermain/settings.py +++ b/bitbake/lib/toaster/toastermain/settings.py | |||
@@ -316,12 +316,12 @@ for t in os.walk(os.path.dirname(currentdir)): | |||
316 | LOGGING = LOGGING_SETTINGS | 316 | LOGGING = LOGGING_SETTINGS |
317 | 317 | ||
318 | # Build paths inside the project like this: BASE_DIR / 'subdir'. | 318 | # Build paths inside the project like this: BASE_DIR / 'subdir'. |
319 | BASE_DIR = Path(__file__).resolve(strict=True).parent.parent | 319 | BUILDDIR = os.environ.get("BUILDDIR", "/tmp") |
320 | 320 | ||
321 | # LOG VIEWER | 321 | # LOG VIEWER |
322 | # https://pypi.org/project/django-log-viewer/ | 322 | # https://pypi.org/project/django-log-viewer/ |
323 | LOG_VIEWER_FILES_PATTERN = '*.log*' | 323 | LOG_VIEWER_FILES_PATTERN = '*.log*' |
324 | LOG_VIEWER_FILES_DIR = os.path.join(BASE_DIR, 'logs') | 324 | LOG_VIEWER_FILES_DIR = os.path.join(BUILDDIR, "toaster_logs/") |
325 | LOG_VIEWER_PAGE_LENGTH = 25 # total log lines per-page | 325 | LOG_VIEWER_PAGE_LENGTH = 25 # total log lines per-page |
326 | LOG_VIEWER_MAX_READ_LINES = 100000 # total log lines will be read | 326 | LOG_VIEWER_MAX_READ_LINES = 100000 # total log lines will be read |
327 | LOG_VIEWER_PATTERNS = ['INFO', 'DEBUG', 'WARNING', 'ERROR', 'CRITICAL'] | 327 | LOG_VIEWER_PATTERNS = ['INFO', 'DEBUG', 'WARNING', 'ERROR', 'CRITICAL'] |