• I have not been receiving emails for errors. I installed WP Mail Logging plugin and nothing is being generated.

Viewing 15 replies - 1 through 15 (of 22 total)
  • Plugin Author Janis Elsts

    (@whiteshadow)

    Here are a few ideas/things to check:

    • Have any new errors been logged since the last time you changed notification settings? The plugin has an internal email timer that is reset every time those settings are changed, so if you change e.g. the notification address then you won’t get any emails until another error happens.
    • Are you using any error type filters? If so, try turning on all errors types as a test.
    • What settings have you selected for the “how often to check the log” and “how often to send email”? If you’re using some of the higher settings, try lowering them.
    • Are you running any other plugins that interact with emails or control who/what can send emails? It’s theoretically possible that a plugin conflict could prevent emails from being sent. Try temporarily deactivating plugins like that.
    • Is there anything special about how WP Cron works on that site? For example, is the DISABLE_WP_CRON constant set to true in your wp-config.php?
    Thread Starter tguarino

    (@tguarino)

    Yes, I was actually triggering errors intentionally to try to get it to work. I tried it with ‘error only’ filter and with all of them. Both time settings were set to 2 minutes for testing purposes. Prior to that they had been at 15. I don’t believe there to be any other plugins like that. DISABLE_WP_CRON is set to false, I don’t believe there are any other cron issues.

    We manage over 1,000 sites. Of those I only ever received 1 email, but there are plenty more having errors.

    Plugin Author Janis Elsts

    (@whiteshadow)

    It sounds like everything is set up correctly. I’m not sure why email notifications are not working for you.

    To help track down the issue, I’ve added a bunch of logging to the development version of the plugin. The plugin will now log a debugging message every time the email cronjob is started and also at different points during the email generation.

    Please install the development version on one of of the affected sites and then try triggering an error. After the configured time interval you should at least see a message like ELM: Email cronjob started in the log. Does it show up? Do any other ELM: ... messages show up?

    Thread Starter tguarino

    (@tguarino)

    Hi, so not only did that work, but the email was sent as well. Do I need to have the wp debug log enabled in order for your plugin to work?

    Thread Starter tguarino

    (@tguarino)

    On another test, I triggered an error at 14:47:13
    then the following:

    [Mon Aug 12 14:48:47.374245 2019] [php7:notice] [pid 21167] [client 104.196.241.26:15234] ELM: Email cronjob started

    [Mon Aug 12 14:48:47.374839 2019] [php7:notice] [pid 21167] [client 104.196.241.26:15234] ELM: Lock acquired

    [Mon Aug 12 14:48:47.375113 2019] [php7:notice] [pid 21167] [client 104.196.241.26:15234] ELM: Preparing new log entry notification about entries logged since 2019-08-12T14:48:47+00:00

    [Mon Aug 12 14:48:47.379357 2019] [php7:notice] [pid 21167] [client 104.196.241.26:15234] ELM: There are no matching entries in that time interval

    [Mon Aug 12 14:48:47.379406 2019] [php7:notice] [pid 21167] [client 104.196.241.26:15234] ELM: Editing because there is no content for a notification

    Plugin Author Janis Elsts

    (@whiteshadow)

    Do I need to have the wp debug log enabled in order for your plugin to work?

    Enabling WP_DEBUG_LOG is one way to make PHP log errors, but you could also directly set the error_log and log_errors options by calling ini_set() or by editing php.ini. It’s a matter of preference.

    However, you do need to enable WP_DEBUG (but not necessarily WP_DEBUG_LOG) if you want to log notices, deprecation messages and other minor stuff. If WP_DEBUG is disabled WordPress will automatically change error logging settings to log only warnings and fatal errors.

    On another test, I triggered an error at 14:47:13
    then the following: […]

    It looks like I put the wrong timestamp in on of the debugging messages by mistake. It’s showing the current time instead of the timestamp of the last entry that was included in an email notification. Please re-download the development version and try that again.

    Also, those messages are not from the PHP error log but from the web server log, correct? Does the error that you triggered show up in the PHP error log?

    Thread Starter tguarino

    (@tguarino)

    Yes they are from the web server log, and they did appear in the PHP error log as well. Since we manage so many sites, I’m only really concerned about errors.

    Plugin Author Janis Elsts

    (@whiteshadow)

    All right, it’s good to know that the errors are at least being logged. Did anything change with the updated development version?

    Thread Starter tguarino

    (@tguarino)

    With the new version, this is still happening:

    [Wed Aug 14 13:42:20.324370 2019] [php7:notice] [pid 21495] [client 104.196.241.26:41210] ELM: Exiting because there is no content for a notification, referer: https://minimallyinstg.wpengine.com/wp-cron.php?doing_wp_cron=1565790139.7297461032867431640625

    [Wed Aug 14 13:42:20.324322 2019] [php7:notice] [pid 21495] [client 104.196.241.26:41210] ELM: There are no matching entries in that time interval., referer: https://minimallyinstg.wpengine.com/wp-cron.php?doing_wp_cron=1565790139.7297461032867431640625

    [Wed Aug 14 13:42:20.321064 2019] [php7:notice] [pid 21495] [client 104.196.241.26:41210] ELM: Preparing new log entry notification about entries logged since 1970-01-01T00:00:00+00:00, referer: https://minimallyinstg.wpengine.com/wp-cron.php?doing_wp_cron=1565790139.7297461032867431640625

    [Wed Aug 14 13:42:20.320774 2019] [php7:notice] [pid 21495] [client 104.196.241.26:41210] ELM: Lock acquired, referer: https://minimallyinstg.wpengine.com/wp-cron.php?doing_wp_cron=1565790139.7297461032867431640625

    [Wed Aug 14 13:42:20.320146 2019] [php7:notice] [pid 21495] [client 104.196.241.26:41210] ELM: Email cronjob started, referer: https://minimallyinstg.wpengine.com/wp-cron.php?doing_wp_cron=1565790139.7297461032867431640625

    [Wed Aug 14 13:40:00.879091 2019] [php7:error] [pid 2784] [client 24.246.120.106:39822] PHP Fatal error:

    with, as stated, no email generated or sent.

    ——–

    Maybe it’s something in the way that the timers work? What’s the exact functionality of the “How often to check the log for new messages” and “How often to send email” settings?

    Thread Starter tguarino

    (@tguarino)

    Also, it’s set right now to check and email every 2 minutes. I noticed a discrepancy…

    [Wed Aug 14 13:52:40.387602 2019] [php7:notice] [pid 31729] [client 104.196.241.26:47968] ELM: Exiting because there is no content for a notification

    [Wed Aug 14 13:52:40.376561 2019] [php7:notice] [pid 31729] [client 104.196.241.26:47968] ELM: Email cronjob started

    [Wed Aug 14 13:48:29.341854 2019] [php7:error] [pid 19138] [client 24.246.120.106:45726] PHP Fatal error:

    [Wed Aug 14 13:48:24.907082 2019] [php7:notice] [pid 11720] [client 104.196.241.26:45638] ELM: Exiting because there is no content for a notification,

    [Wed Aug 14 13:48:24.896930 2019] [php7:notice] [pid 11720] [client 104.196.241.26:45638] ELM: Email cronjob started,

    It ran a check at 1:48 and found nothing. By the settings, it should run again at 1:50. Another error was triggered at 1:48. It didn’t check again until 1:52 and didn’t see the error from 4 minutes prior.

    Thread Starter tguarino

    (@tguarino)

    One more thing… could there be any problems due timezone configuration?

    Thread Starter tguarino

    (@tguarino)

    It looks like it’s running crons at the right interval, but is timestamping two as the same time

    Plugin Author Janis Elsts

    (@whiteshadow)

    WordPress Cron is known to be a bit inaccurate and I’ve heard that it can sometimes trigger the same task several times in a row. However, even if that happens, it shouldn’t prevent emails from being sent.

    One more thing… could there be any problems due timezone configuration?

    Probably not directly, but if it changes the log timestamp format in such a way that the plugin can’t parse the timestamps then that could cause problems. Does the plugin show the correct timestamps in its dashboard widgets? Also, could you post a couple of example timestamps from the log (not from the widget since the format might be different)?

    Also, regarding your post about the time discrepancies, did the log have a line like this for those two cron jobs?
    ELM: Preparing new log entry notification about entries logged since [timestamp]
    If it did, did they show the same timestamp as the earlier example (1970-01-01)?

    Thread Starter tguarino

    (@tguarino)

    here’s from the log
    [14-Aug-2019 15:08:54 UTC] PHP Fatal error:

    [14-Aug-2019 15:07:51 UTC] ELM: Preparing new log entry notification about entries logged since 1970-01-01T00:00:00+00:00

    Thread Starter tguarino

    (@tguarino)

    However, you do need to enable WP_DEBUG (but not necessarily WP_DEBUG_LOG) if you want to log notices, deprecation messages and other minor stuff. If WP_DEBUG is disabled WordPress will automatically change error logging settings to log only warnings and fatal errors.

    In order for the email feature to work at all, I need to enable WP_DEBUG and WP_DEBUG_LOG. This also alters the widget display slightly, not in a bad way, it actually makes it easier to read and more defined.

Viewing 15 replies - 1 through 15 (of 22 total)
  • The topic ‘emails not generating’ is closed to new replies.