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

[DX] Provide UI to define watchdog severity levels #3326

Closed
opi opened this issue Oct 19, 2018 · 23 comments · Fixed by backdrop/backdrop#3001
Closed

[DX] Provide UI to define watchdog severity levels #3326

opi opened this issue Oct 19, 2018 · 23 comments · Fixed by backdrop/backdrop#3001

Comments

@opi
Copy link

opi commented Oct 19, 2018

When reviewing #3279, I need to manually edit the system.core.json config file to update the watchdog_enabled_severity_levels setting.

This should be possible from the web interface. Following PR provides a basic checkboxes form with watchdog severity levels.

Screen Shot 2019-11-24 at 3 09 51 pm


PR by @opi backdrop/backdrop#2328
PR by @klonos (based on @opi's): backdrop/backdrop#3001

@opi
Copy link
Author

opi commented Oct 19, 2018

Related issue #3325

@opi
Copy link
Author

opi commented Oct 19, 2018

Please help me with wording here (https://github.com/backdrop/backdrop/pull/2328/files)

  • '#title' => t("Enabled severity levels"),
  • '#description' => t('Type of messages to log in watchdog')

@klonos
Copy link
Member

klonos commented Oct 19, 2018

PR looks really good @opi 👍 ...just a missing period in the help text + a minor suggestion to add the word "Which" at the beginning.

Very useful!

@klonos
Copy link
Member

klonos commented Oct 19, 2018

Just noting: system.core.json before:

"watchdog_enabled_severity_levels": [
        0,
        1,
        2,
        3,
        4,
        5,
        6
    ],

...and after (ticking the "Debug" and "Deprecated" checkboxes and saving):

"watchdog_enabled_severity_levels": {
        "1": "1",
        "2": "2",
        "3": "3",
        "4": "4",
        "5": "5",
        "6": "6",
        "7": "7",
        "8": "8"
    },

...should be:

"watchdog_enabled_severity_levels": {
        "0": "0",
        "1": "1",
        "2": "2",
        "3": "3",
        "4": "4",
        "5": "5",
        "6": "6",
        "7": "7",
    },

@klonos
Copy link
Member

klonos commented Oct 19, 2018

...so after further testing on my local and on the PR sandbox, I am moving this to NW because when saving the form, no mater what selection of checkboxes you've made, the "Emergency" severity gets unchecked.

@klonos
Copy link
Member

klonos commented Oct 19, 2018

...possibly related #3327 ??

@opi
Copy link
Author

opi commented Oct 19, 2018

PR updated, with new wording (thanks!) and a fix for saved values.

@jlfranklin
Copy link
Member

The UI to manage watchdog_enabled_severity_levels was added to the Devel module. See backdrop-contrib/devel#4 for details. (It was added late in the ticket.)

@klonos
Copy link
Member

klonos commented Oct 19, 2018

...I still think that this deserves to be in core Configuration >> Development >> Logging and errors.

@klonos
Copy link
Member

klonos commented Oct 19, 2018

Thanks for addressing the config save issue @opi 👍 RTBC!

@jenlampton
Copy link
Member

jenlampton commented Jan 1, 2019

edited: I've recommended a minor UX improvement on the PR, and a minor variable name update.

@jenlampton
Copy link
Member

code looks great! testing now...

@jenlampton
Copy link
Member

jenlampton commented Nov 23, 2019

Screen Shot 2019-11-23 at 12 13 34 PM

  1. On the dblog page, there are two filters. One is for "Types" and one is for "Severity". On the admin page, in the label of this new setting, we use the word "Types" when we mean "Severity". Let's change the field label to Severity of messages to log.

  2. Shouldn't the severity filter on the logs page only show the types of messages that are actually in the log? If, for example, I have selected 5 severities of messages on the settings page, shouldn't I only see 5 options on the dblog page? Or better yet... the Type filter only shows types that are in the database. Maybe we should do the same with the Severity filter? (Should this be a separate issue?)

@klonos
Copy link
Member

klonos commented Nov 23, 2019

@jenlampton

  1. I have updated the PR to use Severity of messages to log for label 👍

  2. As per discussions on Gitter, yes, separate issue(s):

    • The checkboxes bit will be solved with [META] [UX] Select2 / SelectWoo in core #3069 and/or children issues, like [UX] Remove multi-select list form elements from core by switching to Select2 #1800.

    • If, for example, I have selected 5 severities of messages on the settings page, shouldn't I only see 5 options on the dblog page?

      Nope. Limiting the list of options of the "Severity" select to only those specified in admin/config/development/logging will not work as expected, because messages of different severities may have been previously logged (ones that are no longer set in admin/config/development/logging). So this will only work as expected if the log messages were cleared (automatically, or manually by the site admin).

    • Or better yet... the Type filter only shows types that are in the database. Maybe we should do the same with the Severity filter? (Should this be a separate issue?)

      Yup. Limiting the list of options to only what has been logged in the db may work better; but follow-up.

@jenlampton
Copy link
Member

Works like a charm, RTBC!

@klonos
Copy link
Member

klonos commented Nov 24, 2019

@jenlampton (and others) I just noticed that the respective setting in Devel has the following description:

Only messages with the enabled severity levels will be logged. The "debug" and "deprecated" levels are recommended for developer environments, but not on production sites.

Do you think that the second bit could be useful here? ...it would match the "It is recommended that sites running on production environments do not display any errors." help text for the types of errors. Let me know, and I'll quickly update the PR.

PS: also making a note to self to file a PR that removes this setting from Devel, if system.module >= 1.14.2

@klonos
Copy link
Member

klonos commented Nov 24, 2019

...as per discussion on Gitter, I've updated the PR, to add the following help text:

The debug and deprecated severity levels are recommended for developer environments, but not on production sites.

Leaving the status as RTBC, since @quicksketch will have a final look anyway 😅

@opi
Copy link
Author

opi commented Nov 24, 2019

Seems all good. Thanks everyone for finishing that

@quicksketch
Copy link
Member

I wasn't entirely certain about this change initially. Though if others feel it should be available then it's fine with me. I think that since we added the "Deprecated" option and started using it all over the place, this setting is a lot more likely to be used than before.

I've merged backdrop/backdrop#3001 into 1.x for 1.15.0. With it right around the corner I'm not going to cherry-pick this back into 1.14.x.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment