Closed (outdated)
Project:
Drupal core
Version:
6.x-dev
Component:
watchdog.module
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
18 Feb 2008 at 15:33 UTC
Updated:
2 Mar 2016 at 22:18 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
dave reidMarked #342709: Improve documentation for watchdog() as a duplicate of this issue. This seems to be an occasionally recurring problem:
#330844: Data too long
#312624: Odd Bug When Executing Action
#341229: Data too long for column 'type'
I don't see any downside to increasing the type character limit to 32. It seems to be a problem not many developers know about, especially since the limit is not documented in watchdog(). We should at a minimum improve the documentation for this problem.
Comment #2
dave reidInitial patch to increase the length of the {dblog}.type field. Added documentation to watchdog() and dblog_watchdog().
Comment #3
chriscohen commentedIs there any reason to limit it to 32? I'm sure that long module names combined with suffixes will come close to exceeding this limit. A length of 64 might be more appropriate, I think.
Comment #4
catchIf we're going to increase it, might as well go to 64.
Comment #5
dave reidRevised patch with the 64-char limit. While browsing through hook_watchdog and implementations of hook_watchdog, I found lots of inconsistencies and errors, most notably, the drupal_mail() in hook_watchdog was the D5-version of the function. :)
Comment #7
dave reidTesting slave #8 failure.
Comment #8
nancydru@chris.cohen: No, there is nothing magical about 32. When I discovered this problem, I did not know enough about all the places where this might be a problem, so I just went to a bit more than I actually needed. I am sure catch is much more versed in internals than I, so if he thinks it can go even larger, I am all for it.
Comment #9
dries commentedPatch looks good to me. Good catch on drupal_mail(). Further proof that it would be really useful to have some functionality that allows us to test drupal_mail() calls ...
Comment #10
david straussLet's extend it to 64 or 128. There is no penalty in MySQL or PostgreSQL for simply having longer VARCHAR columns unless you're hitting maximum index or row length caps.
There are plenty of reasons we wouldn't want to be merely limited to the module name for the type.
Comment #11
dave reidThe patch in #5 actually changes it to 64. Setting back to CNR so I can double check that it still passes with the testing bot.
Comment #12
dries commentedRan my own tests, and everything succeeded. Code looked good too, so committed to CVS HEAD. Thanks Dave.
Comment #13
nancydruFabulous! Thanks Dave and Dries.
Comment #14
ball.in.th commentedHi,
I got here from Data too long for column 'link' in watchdog table which has been flaged as a dup of this issue.
Truncating the link column will prevent the warning about "Data too long" from showing up, but it also makes watchdog less useful because you won't know which *exact link* causes the log entry. If there's no penalty in having a longer varchar column in the database, why not also increase the size to, say, 2000. Just kidding; but something longer than 255.
Comment #16
mustanggb commentedIf some clever chap could port this back to 6.17 that would be great.
Comment #17
nancydruI just went into the database and manually changed it. I have had no fall-out over it.
Comment #18
rdrh555 commentedAttempted:
Comment #19
nancydruIt was changed to 64 above. Plus you should use
drupal_substr.Comment #20
rdrh555 commentedI realized, as soon as I did that, I was working from the wrong patch. I assumed it would need additional work, did I miss anything else? The additional changes in #5 apply to D7?
Comment #21
nimi commentedPlease anyone, could we have a drupal 6.x version of this patch?
Comment #22
nancydru@nimi, you don't really need to wait. All I did was to go into the database and manually change the length for that column. This patch merely makes it official and adds some little niceties. Even if rdrh555 reworks it, there is no guarantee that it will be committed, although IMHO, it does not break the API (although trimming the field might be considered that).
@rdrh555: while I was writing that, I had a thought: if you limit the display to 32, how does that affect the filtering?
Comment #23
mustanggb commentedComment #24
rdrh555 commented@NancyDru, hmm, I don't know, perhaps someone w/more knowledge will comment? Also, curious, when do you use drupal_substr as opposed to substr?
As I was going through the API, I found a comment also referring to having this patched, although for the life of me, I cannot find it again...maybe it was nimi...
So, I redid it with #19 suggestions and higher powers can decide if it will be accepted.
Comment #25
nancydruDrupal_substr is multibyte safe, so unless you know for an absolute fact that you are only using a single byte character set, you should use drupal_substr. Note that almost all Drupal sites use UTF8, which is multibyte. I pretty much always use drupal_substr to be safe. Fortunately the Coder module will warn you.
The patch looks good to me.
Comment #26
thedavidmeister commentedWhat's this about? I didn't see it in the D7 patch and it seems to be a mistake.