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

FS-1015 - Logging utility, config defaults and initialisation added #18

Merged
merged 9 commits into from
Jun 20, 2022

Conversation

harryyo
Copy link
Contributor

@harryyo harryyo commented Jun 15, 2022

  • Logging utility added
  • Colour coded text logs to console in development
  • Json logs in other environments
  • Gunicorn support added
  • Manifests for dev and test updated to use gunicorn rather than Flask run

@harryyo harryyo temporarily deployed to Dev June 15, 2022 12:42 Inactive
@harryyo harryyo temporarily deployed to Dev June 15, 2022 14:58 Inactive
@harryyo harryyo temporarily deployed to Dev June 15, 2022 14:59 Inactive
@harryyo harryyo temporarily deployed to Dev June 15, 2022 15:03 Inactive
@harryyo harryyo temporarily deployed to Dev June 15, 2022 15:42 Inactive
@harryyo harryyo temporarily deployed to Dev June 15, 2022 15:42 Inactive
@harryyo harryyo temporarily deployed to Dev June 15, 2022 15:47 Inactive
… updates to support service running with gunicorn. Dev config updated to set FSD_LOG_LEVEL to debug
@harryyo harryyo temporarily deployed to Dev June 16, 2022 14:12 Inactive
@harryyo harryyo temporarily deployed to Dev June 16, 2022 14:13 Inactive
@harryyo harryyo temporarily deployed to Dev June 16, 2022 14:18 Inactive
@gidsg
Copy link
Contributor

gidsg commented Jun 16, 2022

Some values are coming through as null on PaaS e.g.

{"name": "Authenticator", "levelname": "DEBUG", "message": "Received request GET https://funding-service-design-authenticator-dev.london.cloudapps.digital/magic-links/vlxTWbsY", "funcName": "before_request", ") in %(pathname": null, "lineno": 72, "method": "GET", "url": "https://funding-service-design-authenticator-dev.london.cloudapps.digital/magic-links/vlxTWbsY", "endpoint": "api_MagicLinksView_use", "process_": 113, "thread_": "140234964821632", "instance_index": "0", "time": "2022-06-16 14:49:21,955", "application": "none", "isSampled": null, "debugFlag": null, "logType": "application"}

We should either fix these or remove them.

…imezone log time added and maded consistent across gunicorn and application logs, gunicorn config script location refactored
@harryyo harryyo temporarily deployed to Dev June 20, 2022 08:42 Inactive
gunicorn/config.test.py Outdated Show resolved Hide resolved
@harryyo harryyo temporarily deployed to Dev June 20, 2022 09:09 Inactive
@harryyo harryyo temporarily deployed to Dev June 20, 2022 09:31 Inactive
gunicorn/config.dev.py Outdated Show resolved Hide resolved
@harryyo harryyo temporarily deployed to Dev June 20, 2022 10:09 Inactive
@harryyo harryyo temporarily deployed to Dev June 20, 2022 10:10 Inactive
@harryyo harryyo temporarily deployed to Dev June 20, 2022 10:15 Inactive
@harryyo harryyo temporarily deployed to Dev June 20, 2022 10:28 Inactive
@harryyo harryyo temporarily deployed to Dev June 20, 2022 10:29 Inactive
@harryyo harryyo temporarily deployed to Dev June 20, 2022 10:34 Inactive

First set the FLASK_ENV environment you wish to test eg:

export FLASK_ENV=dev
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

im wondering if this should be stated outside of the 'Run with Gunicorn' section as it applies to running in Flask also

@@ -0,0 +1,365 @@
from __future__ import absolute_import
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this another candidate for our shared utils?

@harryyo harryyo temporarily deployed to Dev June 20, 2022 13:04 Inactive
@harryyo harryyo temporarily deployed to Dev June 20, 2022 13:05 Inactive
@harryyo harryyo temporarily deployed to Dev June 20, 2022 13:10 Inactive
Copy link
Contributor

@gidsg gidsg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍 (We should extract this and move to the utils library ASAP)

@harryyo harryyo merged commit 9ceb7f3 into main Jun 20, 2022
Comment on lines +153 to +156
def now(self):
return datetime.datetime.now(
tz=pytz.timezone("Europe/London")
).strftime("%d-%b-%y %H:%M:%S")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is unused now so can be safely deleted?

@johnoneill46 johnoneill46 deleted the fs-1015-add-logging branch February 10, 2023 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants