Posted by steve02476 on July 1, 2009 at 6:40pm
I check my dblog (watchdog) a lot using Administer >> Reports >> Recent Log Entries
In order to not have the interesting stuff cluttered up by the boring stuff I use the "filter log messages" option and select some types of log messages I want to see and deselect the ones I don't.
But this isn't persistent, so I have to re-select these every time I check the log.
Is there a module that enhances the "recent log entries" function? Thanks!
Comments
Do you mean that filters are
Do you mean that filters are never persistent in your situation, or only when you have been logged out? Filters should be persistent throughout a session, in other words, you should only have to re-select after you have logged out (and logged in again, obviously). I think it shouldn't be too hard to make them really persistent, let me see what I can find out for you.
I just checked
I just checked, and it seems like if I just quit the browser and start it again, without logging out, that the filters are still the same. So they're persistent in that way.
But I frequently do log in and out to test stuff, and I frequently switch browsers and computers. So, I guess what I'm looking for is a way to change the default, which I guess is "all" right now.
I think the dblog filtering is fine for sometimes checking in to see how things are, or to track down a problem. But if I want to check a couple times a day to see who has logged in and what pages have been worked on and what search terms are being used a lot, I can't see that stuff without filtering out "page not found" and "cron" and stuff like that. Maybe I should be doing it a different way?
I cooked up a really simple
I cooked up a really simple module: It saves your selected filters on logging out and loads them again when logging in. A module that allows you to set a default selection would be a little more work, because you would also need a settings page where you can select and save the settings. If you want to try it out, do the following:
1) create a new folder in your modules folder called 'persistent_logfilter'
2) save the following code in the 'persistent_logfilter' folder as 'persistent_logfilter.module'
<?php
// $Id$
/**
* @file
* Save log filter settings on logout, load on login.
*/
/**
* Implementation of hook_user().
*/
function persistent_logfilter_user($op, &$edit, &$account, $category = NULL) {
$uid = $account->uid;
if ($op == 'login') {
$_SESSION['dblog_overview_filter'] = variable_get('persistent_logfilter_'.$uid, NULL);
}
if ($op == 'logout') {
variable_set('persistent_logfilter_'.$uid, $_SESSION['dblog_overview_filter']);
}
}
3) save the following code in the 'persistent_logfilter' folder as 'persistent_logfilter.info'
; $Id$name = Persistent Log Filters
description = Remember filters on the log page
core = 6.x
4) enable the module on admin/build/modules and give it a go
Brilliant!
Brilliant! That works perfectly, does exactly what I was hoping for. I tested it on a XAMPP installation on my home computer, I'll try it out on a real live LAMP test server tomorrow.
Thanks so much. I can't believe I'm the only person who would appreciate this. What would be involved in turning this into a regular downloadable module that would be available to others? If there's any way I could help I'd be glad to. I'm a terrible programmer (I've been a PHP beginner for about 8 years now...) but I can do tech doc and testing.
I think this module will save me a couple dozen control-clicks a day - I owe you big-time. -Steve
Thanks, I'm glad you like it
Thanks, I'm glad you like it :-)
Here is what you need to do to start a new module: http://drupal.org/handbook/cvs/projects. You're welcome to take this code and make a contributed module out of it. However if you consider yourself a terrible programmer, I guess you shouldn't do it yourself, because you would also have to deal with bug reports and other patches (even though this module is really really small). We could do it together if you like, because I have CVS access.
I really do like it
It worked fine on my unix server also. Thanks again.
I'd like to see this be a regular contributed module, but my programming skills and Drupal knowledge aren't enough for me to really support it in case someone runs into a jam or has a technical question. But since you already know how to do the CVS stuff and make a real module if you would be willing to do it then I'd be willing to help with the tech doc, do some testing, and help answer any user questions, plus whatever other stuff needs doing.