mirror of
https://github.com/GSA/notifications-api.git
synced 2026-01-31 06:52:06 -05:00
don't capture logs directly from stdout
previously in run_app_paas.sh, we captured stdout from the app and piped that into the log file. However, this came up with a bunch of problems, mainly: * exceptions with stack traces often weren't formatted properly, and kibana could not parse them * celery logs were duplicated - we'd collect both the json logs and the human readable stdout logs. instead, with the updated utils library, we can use that to log json straight to the appropriate directory directly.
This commit is contained in:
@@ -122,8 +122,8 @@ def test_extract_cloudfoundry_config_populates_other_vars():
|
||||
extract_cloudfoundry_config()
|
||||
|
||||
assert os.environ['SQLALCHEMY_DATABASE_URI'] == 'postgres uri'
|
||||
assert os.environ['LOGGING_STDOUT_JSON'] == '1'
|
||||
assert os.environ['NOTIFY_ENVIRONMENT'] == '🚀🌌'
|
||||
assert os.environ['NOTIFY_LOG_PATH'] == '/home/vcap/logs/app.log'
|
||||
|
||||
|
||||
@pytest.mark.usefixtures('os_environ', 'cloudfoundry_environ')
|
||||
|
||||
@@ -57,24 +57,3 @@ def test_load_config_if_cloudfoundry_not_available(monkeypatch, reload_config):
|
||||
def test_cloudfoundry_config_has_different_defaults():
|
||||
# these should always be set on Sandbox
|
||||
assert config.Sandbox.REDIS_ENABLED is False
|
||||
|
||||
|
||||
def test_logging_stdout_json_defaults_to_off(reload_config):
|
||||
os.environ.pop('LOGGING_STDOUT_JSON', None)
|
||||
assert config.Config.LOGGING_STDOUT_JSON is False
|
||||
|
||||
|
||||
def test_logging_stdout_json_sets_to_off_if_not_recognised(reload_config):
|
||||
os.environ['LOGGING_STDOUT_JSON'] = 'foo'
|
||||
|
||||
importlib.reload(config)
|
||||
|
||||
assert config.Config.LOGGING_STDOUT_JSON is False
|
||||
|
||||
|
||||
def test_logging_stdout_json_sets_to_on_if_set_to_1(reload_config):
|
||||
os.environ['LOGGING_STDOUT_JSON'] = '1'
|
||||
|
||||
importlib.reload(config)
|
||||
|
||||
assert config.Config.LOGGING_STDOUT_JSON is True
|
||||
|
||||
Reference in New Issue
Block a user