Skip to content

Commit

Permalink
Merge pull request #2672 from digitalfabrik/test/cms-log-in-ci
Browse files Browse the repository at this point in the history
Store integreat-cms.log as an artifact after test run in CI
  • Loading branch information
seluianova authored Mar 25, 2024
2 parents bd19b11 + d540ee3 commit c2e9ea7
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 5 deletions.
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
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 @@ -578,7 +578,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

0 comments on commit c2e9ea7

Please sign in to comment.