Hello,
Is there a reason why there is no system.watchdog service? I would find this very usefully and wrote a small watch_service module, but I think this sould rather go into system_service. So am I missing something?

CommentFileSizeAuthor
#6 521346.patch2.61 KBgdd
#5 521346.patch3.17 KBgdd
#2 system_service.module.patch2.33 KBGhostthinker

Comments

marcingy’s picture

Status: Active » Postponed (maintainer needs more info)

If you provide a patch agaist system_service will review it and hopefully add it to the available services - as being part of the system services makes a lot of sense.

Ghostthinker’s picture

Status: Postponed (maintainer needs more info) » Active
StatusFileSize
new2.33 KB

Here is the patch. The question is - how safe is this method. I guess watchdog $message is a powerfull function with no user input checking. I guess it would be better (for me) to keep it a extra module which could be "log_service" and make some custom (safe input) services.

So what do you think about it? Evil patch?

Btw, I'm using logging for real-time flash remote performance and usability tests, if anybody is interested. say hallo.

gdd’s picture

At the very least you should be checking those inputs, yes. At first I wasn't sold on this patch but I might be warming up to it. For remote logging of events from Flash apps it could certainly be useful. I'll give it some thought.

Ghostthinker’s picture

Just a little update on flash logging. When I start my App, I create a Logger class that records everything of importance (mousemovemnet, fps changes, clicks and some variables to watch). On drupal, I store this information with a node type "flash log". When the user leaves the page (javascript event), I call the "sendFlashLog" message. This works very well and is better than using the overfilled watchdog. For example:
I collect the information of significant changes in framerate, so every time the fps changes > 5 I store the (time=>fps) pair in an array. When the performance log is submitted, I convert this data into json (I am using an adapter pattern) and on drupal site i wrote a formatter that displays the json data in a fancy flash graph (don't know the name of the graph atm, but googlebing will help).

Maybe this information is usefull for someone.

Btw:
For "on site" flash "debugging", I use ExternalInterface.call("console.log",message) n my custom trace function -> prints flash/flex traces to firebug;

gdd’s picture

Status: Active » Needs review
StatusFileSize
new3.17 KB

Here is a slightly reworked patch, i think all i did was fix a typo and clean up a couple comments. It turns out that the inputs don't need to be checked since they are run through check_plain() on output, so no big deal.

Can you test this out? If it's good I'll commit it.

gdd’s picture

Status: Needs review » Fixed
StatusFileSize
new2.61 KB

Attached is the patch I committed. It differs from #5

- Severity made an int instead of a string (the severities are constants)
- Severity param was not getting passed through to the call to watchdog()

Thanks all.

gdd’s picture

And for anyone trying to use the previous patch, note that it is missing a hook_perm() definition for the watchdog service. This was corrected here:

http://drupal.org/cvs?commit=304370

The service will not work without this change.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.