Closed (won't fix)
Project:
Drupal core
Version:
7.x-dev
Component:
base system
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
9 Aug 2006 at 22:13 UTC
Updated:
24 Jan 2013 at 17:36 UTC
Jump to comment: Most recent file
Comments
Comment #1
m3avrck commentedSeems like a decent patch.
A few things, there should be an option to turn off error reporting completely. Also, being able to multiselect what you want would make more sense, but obviously, complicates the patch a bit more.
Comment #2
robertdouglass commentedI thought about letting there be a "None" setting while I was drifting off to sleep and beginning to dream Drupal dreams, so here you go.
It would be atypical, I think, to have a multiselect. One would really never want to select Notice but exclude Error, and how would we handle the case where the admin selected "None" and a different level as well.
The patch, as it is, shows the log level selected and everything above it (the watchdog constants get larger with increased severity). So a setting of Notice shows everything, a setting of Warning shows warnings and errors, Error shows just errors, and None shows none.
Comment #3
robertdouglass commentedpatch
Comment #4
cwagar commentedThis patch is great - I've applied it to our multisite install (4.7.3) with over 40k pageviews per day, and it's helping to save us from mysql death.
Kudos, should be part of core.
Comment #5
dries commentedWhy would this make such a big difference? If you want to save on database update, there are better places to focus on IMO. I bet you a beer that this is only a fraction of the total number of write accesses and I bet you another beer that the performance difference won't be noticable.
If it is noticably, I'd like to know more about your setup, and how this is possible. Until then, I'm far from convinced that this is helpful.
Comment #6
killes@www.drop.org commentedRobert, maybe you should support this patch of mine?
http://drupal.org/node/78503
Comment #7
m3avrck commentedDries, even if this doesn't improve performance, what about from an admin level?
I administer a lot of sites and sifting through watchdog can be a nuisance. For some sites, I don't even care to see notices like "user John has logged in", where as I really only want to see PHP errors. Maybe even in some cases, I want to turn off watchdog completely--e.g., I have my own mechanism for errors through PHP error reporting logs and so forth. Why do I need Drupal running some extra CPU cycles and queries when I know I don't need it?
Comment #8
dries commentedWhat I'd like to see happen is an option for each event (eg. 'search', '404', '403') that lets you define its output channel.
The available output channels would be: (i) the website logs (watchdog table), (ii) syslog and (iii) nothing (/dev/null).
Comment #9
robertdouglass commentedso there should be a hook_log that gets called to find a logger for a channel. By default we'll offer watchdog and /dev/null. I'm assuming the syslog isn't in core yet. Or is there a simpler way to make this extensible?
Comment #10
m3avrck commentedCan't we just extend watchdog() to have a new DESTINATION parameter? "drupal", "syslog", "dev/null" ... of course we'll need a new mechanism for the 2nd. Or do we?
If a PHP error occurs, Drupal will catch it. How does PHP errors know about it? Well if Drupal let's it pass through it's logged... how does that happen? I'm actually not sure just typing out loud :-)
But this seems like a reasonable idea, maybe a bit more discussion on the best way to do this.
Comment #11
robertdouglass commented@killes I read the history of the pathes in your issue mentioned above and don't see that the two issues are related.
I like Dries' suggestions and think that a lot could be done with logging and watchdog in general, but still advocate the immediate committing of this patch, as it is. I think it is a good step forward, and isn't invasive, and doesn't add overhead, is not hard to understand, takes nothing away from status quo, and makes a fair number of people happy.
I'll look into more advanced cases for controlling specific aspects of logging, but I still think this patch has merit, as it is.
Comment #12
drummNot a bug.
I think it would be best to log everything and filter on display.
(Aside- I think more specialized logging tables would be good. If you were to go 404 hunting today, I don't think the current watchdog UI is well-suited for this. A table with path, last 404 time, and some indication of frequency would be a better tool.)
Comment #13
dries commentedNeil has a point about the 404s, and the watchdog not being a great tool for that. Maybe we need to think about this some more, and figure out how we'd like to use and filter this information so it can be more useful.
The same is true for the search terms. What you really want is a list of the most popular search terms, ranked by popularity.
Comment #14
cwagar commented@dries
This was extremely helpful for us because we moved from another platform (Scoop) and had 20k nodes and 250k+ comments. Pathauto was helpful for keeping deep links to the story URLs but we chose not to keep deep links to comments. I simply don't need a watchdog INSERT for every 404. I want my 404's in httpd log. And we have a ton of 404's from crawlers, and two+ years worth of links.
Additionally, on a complex site if a single image goes missing (in our case a list item css image), then that's another many thousand 404's every hour until we realize the problem. This patch made the difference between a count(*) watchdog from 500k -> 3k rows. Oh yeah, and I *was* on MyISAM as well and ran into table locking issues.
I've been trolling many of these high performance patches and am in the process of implementing several of them. I see a lot of feedback in the comments to the effect of "so what, no big gain"... Except that too many folks are thinking about things in terms of a new Drupal install, and not a migration like us. $0.02 (or your local currency).
I'll deduct the two beers from the many I owe you for the existence of Drupal ;)
Comment #15
robertdouglass commentedI'm not going to be able to rewrite logging for Drupal by September 1. I feel that being able to easily tell Drupal not to log Watchdog notices is a good feature and would still like to see this patch, exactly as it is, in Drupal. There are a lot of good ideas captured in this discussion, and I would like to see more development in logging going forward, but for Drupal 4.8, I consider this patch a good step forward.
This patch gives administrators an extra level of control over their site. It also reduces database INSERTS, if the logging level is stepped down. It functions in a way that is similar to other logging systems, such as PHP's logging, Apache's logging, log4j, commons-logging and perhaps others. Those systems all have logging levels and you can reduce logging and capture less and less information to suit your needs.
While I agree with Neil that there is merit in capturing everything and making better filtering tools for display, this patch is not about display. This patch is for those administrators who just don't want to log the search terms that people look for, the 404 warnings, new user notifications, new content notifications, new comments, and so forth. This is a real group of people, and most of the people I've spoken to would use this feature at least part of the time. On the other hand, it introduces next to no overhead (one if statement), is easy to comprehend (or ignore), and is just a few lines of code.
Please reconsider committing this one.
Comment #16
varunvnair commented+1 for this patch.
For me this patch gives me the ability to control the extent of logging and makes my life a wee bit easier by not having to wade through events I am not interested in.
Drupal is used in a number of high-traffic sites and in those cases the reduction in the number of queries will also make a difference. Dries is right when he says that there are better areas to focus on for reduction of queries but I argue that this also is one place.
I very much liked Dries approach of reengineering this module to allow admins to configure what event to log as well as the channel to log it to. This will give admins a high degree of control.
However for now I think this patch should be committed.
Comment #17
dries commentedThere are good reasons to keep the information in the database: http://drupal.org/node/79622.
What I think we need is something like this: see attached photoshop mockup. Takers?
Comment #18
cwagar commentedObviously, I lend my support for inclusion into CORE as well. It looks like there is critical mass to maintain this (trivial) patch against 4.8+ in case it's not accepted.
Comment #19
m3avrck commentedReduction of queries on *very* trafficked sites is huge. On average each user will generate 1 watchdog entry (just logging on)... if you have a site where users post lots of new content, these watchdog entries can eat up lots of valuable queries and CPU cycles.
Comment #20
drummI've been working on something like Dries's mock, but using plain old HTML links (which can be AJAXed later) since I don't really see this a place for a form. But, that is not what this issue is about. This is about not logging some things.
Not logging some things honestly scares me a bit. I don't want people put into a situation where they set the logging level to low and then get into a situation where they need the unlogged information. However, other projects do this sort of thing.
I think we certainly need to provide some interface into what is 404ed and what is searched for. Watchdog is probably the wrong thing. This information is relevant to Drupal administrators since it helps them improve their sites. Putting it in the same package makes things much easier for installation, discovery of information, and consistency of experience.
But, all this is beside the point, is it okay to allow users to throw away some logging information? With the number of +1s, I'm thinking this it might be okay.
Comment #21
webchickDries: I agree that 403/404 errors can be useful. Maybe the fix for that though is to make a level between WATCHDOG_NOTICE and WATCHDOG_ERROR or whatever like WATCHDOG_HTTP for these types of errors. Or, alternateiy, make a much more minor setting like WATCHDOG_STATUS for silly messages like "so and so has logged on" or "so and so completed a search" which can totally clog a busy site and don't need any follow-up afterwards.
Comment #22
robertdouglass commentedWebchick has a good suggestion. We could more carefully categorize our messages and make turning bits off more acceptable.
As for throwing search information away, this is all in the Apache log, so it is not lost. 404 and 403 information, however is harder to get at, I believe.
Drumm, do share your work in this direction here so that others can work on it too.
Comment #23
webchickCool. In the interest of splitting things up where possible, I've made a separate issue for adding a WATCHDOG_STATUS message: http://drupal.org/node/80808
I'll try and roll a patch for this later, but the sooner someone does it, the sooner potentially this could get into HEAD, so if you're around over the next few hours, feel free to take a stab. :)
Comment #24
dries commentedIs the issue:
ma3vck: one insert a second sounds like peanuts to me. What is the ratio of watchdog inserts versus other queries and versus other inserts? It would be great to share some of that data to motivate the need for ignoring certain watchdog events (1).
Comment #25
FiReaNGeL commented"This patch is for those administrators who just don't want to log the search terms that people look for, the 404 warnings, new user notifications, new content notifications, new comments, and so forth."
I am part of this group. The website I plan to launch on Drupal will have millions of nodes at first, and I don`t find 'user x has logged on' and 'user x searched for uyaz' useful in my watchdog table (though I understand some might find this info usefull). Also, for high traffic websites, the inserts in watchdog table for just about everything do add up, and if they provide no additional functionality (for me), well, I would love to have the option to set the logging level to what I find suitable.
So its an issue of potential performance gain on high traffic websites, and personal preferences about what should be logged and what shouldnt.
+1 for me - if this doesnt make it into core, any chance of at the very very least, a module?
Also, changed status to 6.x-dev, as I think its a little late for that for 5.0 :)
Comment #26
dwwi haven't read this whole issue, but i was asked to comment here about negative performance impact of watchdog() on big, real sites. see http://drupal.org/node/105223#comment-232094 -- removing the 2 watchdog() calls per release in the packaging script made a *huge* difference in the responsiveness of d.o during the "dreaded packaging hour" (noon/midnight) GMT. it shaved 4 minutes off the total time of the packaing script (from ~23 minutes to ~19, so over 17% of the total time!) and d.o was downright snappy during all but the first minute or so (during the "query of doom")... YMMV.
Comment #27
kbahey commentedThe patch for hook_watchdog is now in core, which means modules can decide what to do with logging. The module called watchdog.module is now called dblog.module and is no longer mandatory. If it is disabled, then no logging whatsoever will happen. There is also syslog.module in core, which can route messages to flat files or remote hosts, hence relieving the database.
So, do we need this anymore given the above? Perhaps setting a default level is still of value to reduce noise (e.g. if you are using something like the emaillog.module which is part of the logging and alerts project), but the performance aspects can be dealt with using other means (see above).
Comment #28
robertdouglass commentedThanks Khalid.
Comment #29
kongoji commentedI rolled a patch against dblog 6.x module to let admin set desired levels for watchdog inserts. This could be useful for very high traffic sites to reduce db inserts.
Comment #30
thlafon commentedI adapted the previous patch of kongoji for dblog 7.x module