Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The syslog_watchdog
function uses theme()
, which is not a good behavior, as if the theme system is not working, no watchdog messages will be logged.
What is more, in case of drupal_not_found
the current theme (like garland) cannot be changed to a $custom_theme
, as the theme is already initialized by the theme call that was triggered by watchdog ► syslog_watchdog.
I've attached a D7 and D6 patch for the syslog.module
.
Comment | File | Size | Author |
---|---|---|---|
#39 | syslog_format_D6.patch | 3.69 KB | catch |
#24 | syslog_theme.patch | 3.69 KB | omerida |
#22 | syslog_theme.patch | 3.72 KB | bkalbs |
#16 | syslog_format.patch | 3.67 KB | JacobSingh |
#9 | syslog.patch | 4.33 KB | mfb |
Comments
Comment #1
marcingy CreditAttribution: marcingy commentedSetting to needs review
Comment #4
mfbIf syslog_watchdog() is called early in bootstrap, the theme() function does not exist yet, which results in a fatal error.
In case anyone else hits this issue, this is the patch I applied to work-around the fatal error so I could access my site:
Comment #5
mfbOne thing about syslog-d7-theme.patch: If syslog_watchdog is called early in bootstrap, we have the same problem with drupal_alter() as with theme(): the function is not yet defined.
Comment #6
mfbHere's the fatal error for anyone experiencing errors/warnings during bootstrap and using syslog: PHP Fatal error: Call to undefined function theme() in /modules/syslog/syslog.module on line 83
Comment #7
mfbRemoved drupal_alter() so syslog works in early bootstrap. Also changed the tokens to use "!" rather than "%" to match those in plain-text e-mails (the variables are not HTML-encoded).
Comment #8
moshe weitzman CreditAttribution: moshe weitzman commentedLooks reasonable to me. Would be good to get another pair of eyes.
Comment #9
mfbReroll due to #716496: Theme functions group needs some updates
Comment #10
JacobSingh CreditAttribution: JacobSingh commentedLooks good to me. Nice work!
Comment #11
Dries CreditAttribution: Dries commentedCommitted to CVS HEAD.
Comment #13
JacobSingh CreditAttribution: JacobSingh commentedHey, should we get a back port of this?
Comment #14
Gábor HojtsySeen this bug on D6 sites as well, I agree this'd need a backport.
Comment #15
kenorb CreditAttribution: kenorb commentedThe same problem during CRON run with Drupal 6.20
Cron shouldn't init theme functions.
But:
drupal_cron_run() calls:
watchdog('cron', 'Attempting to re-run cron while it is already running.', array(), WATCHDOG_WARNING);
which calls syslog_watchdog()
then theme('syslog_format', ) syslog.module:86
which init the whole theme by: init_theme()
The same with: drupal_cron_cleanup()
it's registered as shutdown function in common.inc (drupal_cron_run())
which cause: watchdog($type = 'cron', $message = 'Cron run exceeded the time limit and was aborted.')
and the same problem with init_theme() which is just beginning of the problems, because when doing shutdown on Apache, the whole Drupal is broken, because current path is not pointing to Drupal core, causing lots of other weird errors.
Comment #16
JacobSingh CreditAttribution: JacobSingh commentedHere is a D6 version of the same. Of course there is no backwards compatibility for people using the theme() call, but it's still worthwhile.
Comment #18
anusornwebsite CreditAttribution: anusornwebsite commentedWarning: openlog() has been disabled for security reasons in syslog_watchdog() (line 94 of /home/name/domains/sitename.com/public_html/modules/syslog/syslog.module). This is my problem that show me when I just installed and enable Syslog module.
Comment #19
bfroehle CreditAttribution: bfroehle commented@anusornwebsite: Please do not hijack existing issues for new bugs. Instead, please file a new issue. Thanks.
Comment #20
anusornwebsite CreditAttribution: anusornwebsite commentedsyslog-d7-theme.patch queued for re-testing.
Comment #21
omerida CreditAttribution: omerida commentedpatch #16 worked for me but I had to do
patch < syslog_format_0.patch
for it to apply.Comment #22
bkalbs CreditAttribution: bkalbs commentedHere is an updated patch that should apply this
Comment #24
omerida CreditAttribution: omerida commentedpatch attempt
Comment #25
omerida CreditAttribution: omerida commentedComment #27
oranjer CreditAttribution: oranjer commentedHi All
After i change my hosting and update my database everything seem to work properly but there some error occur here :
any idea ?
Thank in advance
Oranjer
Comment #28
bfroehle CreditAttribution: bfroehle commentedoranjer: disable the syslog module.
Comment #29
oranjer CreditAttribution: oranjer commentedthank you bfroehle
I will do as your advice.
regards
Oranjer
Comment #30
digi24 CreditAttribution: digi24 commentedI do not understand #22 and #24. Are they made just the wrong way (new->old), or is there something different inside the logic.
Logic from #16 works for me.
Comment #31
donquixote CreditAttribution: donquixote commentedsubscribe.
Comment #32
donquixote CreditAttribution: donquixote commentedthis also lets the block administration page (admin/build/block) fail to switch theme.
(just to mention it)
Comment #33
anavarreSubscribe
Comment #34
catchThis is broken enough it should be major.
Comment #35
Dave ReidHuh? This has already been fixed in 7.x and above in http://drupal.org/node/659784#comment-2871880. This is about backporting this to 6.x now.
Comment #36
catchDoh, this is a backport, but I got very confused by the hijacking.
Comment #37
xjmMaybe adding to the title will help prevent the same confusion. :)
Comment #38
pklns CreditAttribution: pklns commentedsyslog-d6-theme.patch queued for re-testing.
Comment #39
catchThis is a straight re-roll of Jacob's patch in #16 (subsequent patches were reverts for some reason), just for the git migration.
Also marking RTBC.
Comment #40
catchActually marking RTBC this time.
Comment #41
fitzherbert caruthers CreditAttribution: fitzherbert caruthers commentedsyslog-d7-theme.patch queued for re-testing.
Comment #42
ryan.gibson CreditAttribution: ryan.gibson commentedWorked for me. Seems like this is RTBC!
Comment #43
kenorb CreditAttribution: kenorb commentedComment #44
scor CreditAttribution: scor commentednot sure why this was switched to needs backport