Hello, Is it possible to disable watchdog globally using function/API? Thanks.
module_disable(module_implements('watchdog')); should do it. ________________________________________ De : development-bounces@drupal.org [development-bounces@drupal.org] de la part de Ryan Chan [ryanchan404@gmail.com] Date d'envoi : samedi 19 février 2011 14:40 À : development@drupal.org Objet : [development] Disable watchdog globally Hello, Is it possible to disable watchdog globally using function/API? Thanks.
On Sun, Feb 20, 2011 at 12:08 AM, sivaji j.g <sivaji2009@gmail.com> wrote:
On Sat, Feb 19, 2011 at 7:24 PM, fgm <fgm@osinet.fr> wrote:
module_disable(module_implements('watchdog'));
Don't try this. It attempts to disable "system" the core required module in D6.
I am using D7, so assume it is ok? Thanks.
None of this is ok, as the function watchdog() is used everywhere, and it would then be an undefined function. It just doesn't make any sense from the beginning. If you don't want the database logging, you can disable the dblog module and enable syslog instead, or use another backend logging module. -Randy On Sat, Feb 19, 2011 at 9:24 AM, Ryan Chan <ryanchan404@gmail.com> wrote:
On Sun, Feb 20, 2011 at 12:08 AM, sivaji j.g <sivaji2009@gmail.com> wrote:
On Sat, Feb 19, 2011 at 7:24 PM, fgm <fgm@osinet.fr> wrote:
module_disable(module_implements('watchdog'));
Don't try this. It attempts to disable "system" the core required module
in
D6.
I am using D7, so assume it is ok?
Thanks.
-- Randy Fay Drupal Module and Site Development randy@randyfay.com +1 970.462.7450
Hmmm, Randy, I'm afraid no one asked how to remove the watchdog function, which would cause the problems you describe, but how to disable it, meaning (AIUI) how to cause it to have no effect, for which one really needs to disable every module implementing its hook_watchdog(), not just dblog.module. As you very well know, there are several alternative modules implementing it, including syslog. This being said, having drush implement it on behalf of system.module does not look (to me) like a safe practice, as can be seen from the sample consequence mentioned by sivaji. This being said, a hackish/interesting alternative would be to use runkit_function_redefine() to change the normal implementation, but that's definitely not good practice. ----- Original Message ----- From: "Randy Fay" <randy@randyfay.com> To: <development@drupal.org> Sent: Saturday, February 19, 2011 5:49 PM Subject: Re: [development] RE : Disable watchdog globally
None of this is ok, as the function watchdog() is used everywhere, and it would then be an undefined function. It just doesn't make any sense from the beginning.
If you don't want the database logging, you can disable the dblog module and enable syslog instead, or use another backend logging module.
-Randy
On Sat, Feb 19, 2011 at 9:24 AM, Ryan Chan <ryanchan404@gmail.com<mailto:ryanchan404@gmail.com>> wrote: On Sun, Feb 20, 2011 at 12:08 AM, sivaji j.g <sivaji2009@gmail.com<mailto:sivaji2009@gmail.com>> wrote:
On Sat, Feb 19, 2011 at 7:24 PM, fgm <fgm@osinet.fr<mailto:fgm@osinet.fr>> wrote:
module_disable(module_implements('watchdog'));
Don't try this. It attempts to disable "system" the core required module in D6.
I am using D7, so assume it is ok?
Thanks.
-- Randy Fay Drupal Module and Site Development randy@randyfay.com<mailto:randy@randyfay.com> +1 970.462.7450
Isn't it safer to just provide another backend logging module, that does nothing Best regards, Peter Droogmans Attiks Ketsstraat 94 2140 Borgerhout Belgium 32 3 288 61 17 32 497 44 44 77 -----Original Message----- From: development-bounces@drupal.org [mailto:development-bounces@drupal.org] On Behalf Of FGM Sent: zaterdag 19 februari 2011 6:33 PM To: development@drupal.org Subject: Re: [development] RE : Disable watchdog globally Hmmm, Randy, I'm afraid no one asked how to remove the watchdog function, which would cause the problems you describe, but how to disable it, meaning (AIUI) how to cause it to have no effect, for which one really needs to disable every module implementing its hook_watchdog(), not just dblog.module. As you very well know, there are several alternative modules implementing it, including syslog. This being said, having drush implement it on behalf of system.module does not look (to me) like a safe practice, as can be seen from the sample consequence mentioned by sivaji. This being said, a hackish/interesting alternative would be to use runkit_function_redefine() to change the normal implementation, but that's definitely not good practice. ----- Original Message ----- From: "Randy Fay" <randy@randyfay.com> To: <development@drupal.org> Sent: Saturday, February 19, 2011 5:49 PM Subject: Re: [development] RE : Disable watchdog globally
None of this is ok, as the function watchdog() is used everywhere, and it would then be an undefined function. It just doesn't make any sense from the beginning.
If you don't want the database logging, you can disable the dblog module and enable syslog instead, or use another backend logging module.
-Randy
On Sat, Feb 19, 2011 at 9:24 AM, Ryan Chan <ryanchan404@gmail.com<mailto:ryanchan404@gmail.com>> wrote: On Sun, Feb 20, 2011 at 12:08 AM, sivaji j.g <sivaji2009@gmail.com<mailto:sivaji2009@gmail.com>> wrote:
On Sat, Feb 19, 2011 at 7:24 PM, fgm <fgm@osinet.fr<mailto:fgm@osinet.fr>> wrote:
module_disable(module_implements('watchdog'));
Don't try this. It attempts to disable "system" the core required module in D6.
I am using D7, so assume it is ok?
Thanks.
-- Randy Fay Drupal Module and Site Development randy@randyfay.com<mailto:randy@randyfay.com> +1 970.462.7450
Aside from the academic curiosity of it, what possible purpose is there to disabling *all* of Drupal's logging and tracking capability? Certainly not performance. (If you're trying to improve performance that way, you're missing something bleedingly obvious elsewhere.) If you really want Drupal to do *nothing* to help you at all, the dblog and syslog modules are, I think, the only core modules to do anything with hook_watchdog() so you can just disable those. But still, don't do that. What are you actually trying to accomplish? --Larry Garfield On Saturday, February 19, 2011 7:40:24 am Ryan Chan wrote:
Hello,
Is it possible to disable watchdog globally using function/API?
Thanks.
Thanks all for the suggestions. On Sun, Feb 20, 2011 at 4:29 AM, Larry Garfield <larry@garfieldtech.com> wrote:
But still, don't do that. What are you actually trying to accomplish?
I am running the Drupal functions such as node_load from command line PHP program, so I don't want it to be logged.
Are you perhaps thinking of site statistics and not watchdog? The watchdof logs do not typically have any entries for node load and such unless there are errors while you are doing so. Is it that you do not want you site statistic muddled the script calls or that you don't want things like php errors recorded for the scripts you write? I think people have been giving you advice about the latter and not the former. Sent from my iPad On Feb 20, 2011, at 1:34 AM, Ryan Chan <ryanchan404@gmail.com> wrote:
Thanks all for the suggestions.
On Sun, Feb 20, 2011 at 4:29 AM, Larry Garfield <larry@garfieldtech.com> wrote:
But still, don't do that. What are you actually trying to accomplish?
I am running the Drupal functions such as node_load from command line PHP program, so I don't want it to be logged.
Hi, On Mon, Feb 21, 2011 at 8:29 AM, Dave Metzler <metzler.dl@gmail.com> wrote:
Are you perhaps thinking of site statistics and not watchdog? The watchdof logs do not typically have any entries for node load and such unless there are errors while you are doing so. Is it that you do not want you site statistic muddled the script calls or that you don't want things like php errors recorded for the scripts you write? I think people have been giving you advice about the latter and not the former.
Thanks. Basically, for example, if my script contains error, I don't want it to be logged in Drupal, since the error is not related to Drupal itself. I have tried "module_disable(module_implements('watchdog'));", it do the trick, but I just wonder if any side effect (hidden)? But my script is working anyway. Thanks.
participants (8)
-
Dave Metzler -
fgm -
FGM -
Larry Garfield -
Peter Droogmans -
Randy Fay -
Ryan Chan -
sivaji j.g