Skip to content

enh(controller): Make log level configurable - #126

Closed
jfuechsl wants to merge 1 commit into
teamhephy:masterfrom
engineyard:enh/configurable-log-level
Closed

jfuechsl wants to merge 1 commit into
teamhephy:masterfrom
engineyard:enh/configurable-log-level

Conversation

@jfuechsl

Copy link
Copy Markdown
Contributor

This PR introduces an env var LOG_LEVEL which sets the logging level of the controller. I will open a PR to add the var to the docs once this is ok'd.

# https://docs.djangoproject.com/en/1.11/ref/settings/#debug
DEBUG = bool(os.environ.get('DEIS_DEBUG', False))

LOG_LEVEL = os.environ.get('LOG_LEVEL', 'DEBUG')

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Default to DEBUG...? It should default to INFO as running DEBUG in production Django is not the default....

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ok, I can see that it should be INFO. Will change it.

@Cryptophobia

Copy link
Copy Markdown
Member

I'm not sure there is any improvement to the current way the log level is configured here...?

There are only two modes in django, either DEBUG or INFO. Default should be INFO level.

@jfuechsl

Copy link
Copy Markdown
Contributor Author

Yeah, I see your point. Setting DEBUG would set the root logger level to DEBUG and propagate it down to the child loggers.
The other (for me more important change) is to set the formatter of the console logger to verbose (from simple). Is this something you would approve of?

@Cryptophobia

Copy link
Copy Markdown
Member

@jfuechsl , so the question is if we want to use simple log format vs. verbose format?

LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'formatters': {
        'verbose': {
            'format': '{levelname} {asctime} {module} {process:d} {thread:d} {message}',
            'style': '{',
        },
        'simple': {
            'format': '{levelname} {message}',
            'style': '{',
        },

I'm not sure asctime, module, process:d, thread:d are a big benefit... I think maybe module is the biggest benefit because it can tell us which parts of the API the error or info message is coming from?

If you change it to verbose I am not opposed to the change... @kingdonb @felixbuenemann what do you guys think?

@jfuechsl

Copy link
Copy Markdown
Contributor Author

We could introduce a LOG_VERBOSE env var which switches the logging to verbose and otherwise defaults to simple?

@Cryptophobia

Copy link
Copy Markdown
Member

We could introduce a LOG_VERBOSE env var which switches the logging to verbose and otherwise defaults to simple?

I like it. That would be the best configurable route to allow for customizing the logs and keep it backwards compatible as a default.

Can you also change the commit msg to chore(... or feat(...?

enh(... is not really supported by our parser here: https://docs.teamhephy.com/contributing/submitting-a-pull-request/#commit-style

@jfuechsl

Copy link
Copy Markdown
Contributor Author

I created #131 which supersedes this one. When can close this.

@Cryptophobia

Copy link
Copy Markdown
Member

Closing this in favor of #131

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.

2 participants