[translations] Administrator locale aware watchdog logs

Gabor Hojtsy gabor at hojtsy.hu
Tue Aug 1 15:48:40 UTC 2006


Hi,

   http://drupal.org/node/76588

The problem with the current watchdog() calls is that the messages are 
stored in the actual locale used to present that page. Ie. if you have a 
German, French and English section (version) of your site, watchdog logs 
will be recorded in all three languages intermixed with each other. 
Administrators reviewing logs are supposed to understand all languages 
used on the site to understand possible problems. This is not the desired 
user experience.

To make the watchdog logs admin locale aware, we need to postpone the t() 
call to the time the log is presented to the administrator and should not 
t() the string on storage time. This also means that we should store the 
message in English, and the variables separately in a different field. I 
have chosen serialize()/unserialize() to store the array.

We should note that for backward compatibility the previous watchdog 
messages should have an 'N;' value in the field (the serialization of 
NULL). This needs an upgrade path, which is not yet implemented in the 
patch, but is quite simple. Some messages in system.install for example 
also log stuff which is user defined, so t()-ing it is not desired. With 
specifying N; in the variables field, it is possible to keep those away 
from t().

Pros of this approach:
* Actual locale used to present messages to the administrator
* Messages stored before any locale is available (ie. install time 
messages) are later translated so easier to review and understand

Cons:
* Tablesorting of watchdog messages on the admin interface is not directly 
done using the displayed value. So eg. 404 messages with different file 
names will not get sorted by the filename, which is only added after the 
tablesort is done.
* Slightly more storage requirement for the watchdog table.

In my patch, I have updated the watchdog() function used to store messages 
and the two watchdog review interfaces in watchdog.module. As an example, 
I also updated the user.module (also fixing some missing theme placeholder 
calls). This is not a complete patch, updating of other watchdog calls and 
the upgrade path is also required.

/Since this change requires all watchdog() calls changed to run without 
errors, I have not tested the change in runtime. First I would like to 
gather opinions on the viability of the patch to put more work into it./

Please review and comment on the issue!

Gabor


More information about the translations mailing list