Skip to content

Commit

Permalink
feat: attempting a new fix for the local log format problem
Browse files Browse the repository at this point in the history
The previous attempt to set a local log format failed because first the base configuration files are applied, in which the logging format is set via a function call, and then the overrides come in from edx-internal. Basically, there's a timing problem.

This is an attempt to solve that problem in the hopes that the environment variables are set before the configuration files for the application are run. This change will be made in conjunction with a PR on at ex-internal.

FIXES: APER-3805
  • Loading branch information
deborahgu committed Dec 5, 2024
1 parent df9cdd5 commit 6407704
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion credentials/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@
ACE_CHANNEL_SAILTHRU_TEMPLATE_NAME = "" # unused, but required to be set or we see an exception

# Set up logging for development use (logging to stdout)
LOGGING_FORMAT_STRING = ""
LOGGING_FORMAT_STRING = os.environ.get("LOGGING_FORMAT_STRING", "")
LOGGING = get_logger_config(debug=DEBUG, dev_env=True, local_loglevel="DEBUG", format_string=LOGGING_FORMAT_STRING)

# DRF Settings
Expand Down
2 changes: 1 addition & 1 deletion credentials/settings/devstack.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

ALLOWED_HOSTS = ["*"]

LOGGING_FORMAT_STRING = ""
LOGGING_FORMAT_STRING = os.environ.get("LOGGING_FORMAT_STRING", "")
LOGGING = get_logger_config(debug=True, dev_env=True, local_loglevel="DEBUG", format_string=LOGGING_FORMAT_STRING)
del LOGGING["handlers"]["local"]

Expand Down
2 changes: 1 addition & 1 deletion credentials/settings/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
USER_CACHE_TTL = 60

# LOGGING
LOGGING_FORMAT_STRING = ""
LOGGING_FORMAT_STRING = os.environ.get("LOGGING_FORMAT_STRING", "")

Check warning on line 59 in credentials/settings/local.py

View check run for this annotation

Codecov / codecov/patch

credentials/settings/local.py#L59

Added line #L59 was not covered by tests
LOGGING = get_logger_config(debug=True, dev_env=True, local_loglevel="DEBUG", format_string=LOGGING_FORMAT_STRING)

#####################################################################
Expand Down
2 changes: 1 addition & 1 deletion credentials/settings/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"credentials.apps.edx_credentials_extensions",
]

LOGGING_FORMAT_STRING = ""
LOGGING_FORMAT_STRING = os.environ.get("LOGGING_FORMAT_STRING", "")
LOGGING = get_logger_config(debug=False, dev_env=True, local_loglevel="DEBUG", format_string=LOGGING_FORMAT_STRING)
ALLOWED_HOSTS = ["*"]

Expand Down

0 comments on commit 6407704

Please sign in to comment.