Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store integreat-cms.log as an artifact after test run in CI #2672

Merged
merged 1 commit into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,12 @@ jobs:
paths:
- cc-test-reporter
- coverage
- run:
name: Copy CMS log
command: cp integreat_cms/integreat-cms.log integreat-cms.log
timobrembeck marked this conversation as resolved.
Show resolved Hide resolved
when: on_fail
- store_artifacts:
path: integreat-cms.log
upload-test-coverage:
docker:
- image: cimg/base:stable
Expand Down
72 changes: 68 additions & 4 deletions integreat_cms/core/circleci_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,75 @@
DEEPL_AUTH_KEY = "dummy"
#: Enable manually because existing setting derives from the unset env var
DEEPL_ENABLED = True
#: Use debug logging on CircleCI
LOG_LEVEL = "DEBUG"
#: Disable linkcheck listeners on CircleCI
LINKCHECK_DISABLE_LISTENERS = True
#: Enable logging of all entries from the messages framework
MESSAGE_LOGGING_ENABLED = True
# Disable background tasks during testing
BACKGROUND_TASKS_ENABLED = False
#: Enable logging of all entries from the messages framework
MESSAGE_LOGGING_ENABLED = True
#: Use debug logging on CircleCI
LOG_LEVEL = "DEBUG"
#: Logging configuration dictionary (see :setting:`django:LOGGING`)
LOGGING = {
"version": 1,
"disable_existing_loggers": False,
"formatters": {
"management-command": {
"()": ColorFormatter,
"format": "{message}",
"style": "{",
},
"logfile": {
"()": RequestFormatter,
"format": "{asctime} {levelname:7} {name} - {message}",
"datefmt": "%b %d %H:%M:%S",
"style": "{",
},
},
"filters": {
"only_stdout": {
"()": "django.utils.log.CallbackFilter",
"callback": lambda record: record.levelno <= SUCCESS,
},
},
"handlers": {
# Send DEBUG, INFO and SUCCESS to stdout
"management-command-stdout": {
"class": "logging.StreamHandler",
"filters": ["only_stdout"],
"formatter": "management-command",
"level": "DEBUG",
"stream": sys.stdout,
},
# Send WARNING, ERROR and CRITICAL to stderr
"management-command-stderr": {
"class": "logging.StreamHandler",
"formatter": "management-command",
"level": "WARNING",
},
"logfile": {
"class": "logging.FileHandler",
"filename": LOGFILE,
"formatter": "logfile",
},
},
"loggers": {
"integreat_cms": {
"handlers": ["logfile"],
"level": LOG_LEVEL,
},
"integreat_cms.core.management.commands": {
"handlers": [
"management-command-stdout",
"management-command-stderr",
"logfile",
],
"level": LOG_LEVEL,
"propagate": False,
},
"auth": {
"handlers": ["logfile"],
"level": "INFO",
},
},
}
2 changes: 1 addition & 1 deletion integreat_cms/core/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@
)

#: Logging configuration dictionary (see :setting:`django:LOGGING`)
LOGGING: Final[dict[str, Any]] = {
LOGGING: dict[str, Any] = {
"version": 1,
"disable_existing_loggers": False,
"formatters": {
Expand Down