Dblog is a handy module as it allows one to see issues in a single place, filter, sort, etc. It is also especially handy if you run multiple web heads. However, it is also prone to hammer your database server with requests and make it cry uncle--especially if PHP notices are enabled and there is some bad code living on your site.

Enter the ability to filter log entries *before* they go into dblog. This patch adds two fields to the error logging config page where you pick what severity levels you want to allow into the watchdog table as well as what types you want to allow into the watchdog table.

Any new log types are automatically allowed and have to be deliberately deselected. Also, by default, all severity levels are allowed. Because of this I feel that it can be slipped into 7.x because its default config does not alter Drupal's default behavior.

Also, one other thing in here is the index of the severity column in the watchdog table. If we're filtering by it (possibly exclusively) then we should have an index on it.

Comments

soyarma’s picture

StatusFileSize
new4.49 KB

Non borked patch file attached.

soyarma’s picture

Status: Active » Needs review

Go forth and test, test bot

anavarre’s picture

Subscribe

Status: Needs review » Needs work

The last submitted patch, dblog.patch, failed testing.

soyarma’s picture

Status: Needs work » Needs review
StatusFileSize
new4.49 KB

Oops, in recreating the patch I inadvertently called the watchdog table dblog :S. Fixed.

Status: Needs review » Needs work

The last submitted patch, dblog.patch, failed testing.

soyarma’s picture

Status: Needs work » Needs review
StatusFileSize
new3.99 KB
gcassie’s picture

Instead of variable_get('dblog_allowed_severities', array(0,1,2,3,4,5,6,7)); how about variable_get('dblog_allowed_severities', watchdog_severity_levels());?

Status: Needs review » Needs work

The last submitted patch, dblog_1295182.patch, failed testing.

soyarma’s picture

Status: Needs work » Needs review

#7: dblog_1295182.patch queued for re-testing.

soyarma’s picture

I believe that watchdog_severity_levels() returns the array with 0-7 as the keys and the names as the values. What I need is 0-7 as the values at that point.

bryanhirsch’s picture

soyarma, re gcassie's suggestion, instead of:

variable_get('dblog_allowed_severities', array(0,1,2,3,4,5,6,7));

how about:

variable_get('dblog_allowed_severities', array_keys(watchdog_severity_levels()));
bryanhirsch’s picture

StatusFileSize
new3.97 KB

This patch includes changes proposed in comment #12.

I also noticed inconsistency in use of dblog_allowed_severity v. dblog_allowed_severities. I fixed this too.

Here are some UX issues which probably need some attention:
https://skitch.com/bryan.hirsch/g3qga/logging-and-errors-contrib7.dev

Status: Needs review » Needs work

The last submitted patch, dblog-1295182-13.patch, failed testing.

bryanhirsch’s picture

Status: Needs work » Needs review
StatusFileSize
new4.11 KB

This patch resolves the UX issues I raised in #13.

Status: Needs review » Needs work

The last submitted patch, dblog-1295182-14.patch, failed testing.

bryanhirsch’s picture

Status: Needs work » Closed (duplicate)

Closing, marking as duplicate. Work on this should be moved to 1408208. If anyone disagrees, please reopen.

As I explained here, http://drupal.org/node/1408208#comment-5480994, resolving this issue for dblog and syslog separately doesn't make sense. Both modules form_alter the same System module form. Both modules need this same functionality. Fixing these separately will inevitably lead to inconsistent patterns in the UI and bad UX. My most recent patch is posted with issue 1408208, including all the stuff in patches here, resolutions to UX issues from the skitch in comment #13, and the same functionality for Syslog module.