Can the Feeds_log perhaps work together with Drupal's syslog.module? I would like to disable the MySQL logging on a production site, optionally throw Exception into the syslog instead.

Comments

alan d.’s picture

Title: Use syslog.module for feeds_log (and have option to disable MySQL log) » Use syslog.module for feeds_log and/or an option to disable log
Category: bug » feature
Status: Active » Needs review

Yep this would be nice, we have 4,500 entries in ours, making dumps to the test sites slower than they should be. (table size is 35.7 MiB)

The attached patch allows developers to alter:

a) turn off feeds log completely
b) to restrict the age limit in the log

usage

// Only keep feed logs for one hour.
variable_set('feeds_log_maximum_age', 3600);

// Disable logging altogether
variable_set('feeds_log_enabled', 1);
alan d.’s picture

StatusFileSize
new1.88 KB
deviantintegral’s picture

StatusFileSize
new2.4 KB

The above patch looked good, but in our case we wanted to actually log errors to syslog on production. Here's an update that changes logging to:

  • By default, log to the database. I thought about a separate variable, but I think having dblog enabled is a good enough check for most users.
  • Otherwise, if database logging is disabled, we send the message directly to watchdog().
deviantintegral’s picture

StatusFileSize
new2.32 KB

Fixing comments from a previous approach I tried.

deviantintegral’s picture

StatusFileSize
new2.32 KB

Prefix our log messages with "feeds" for easier identification.

elliotttf’s picture

Status: Needs review » Reviewed & tested by the community

This worked perfectly for me. Disabled dblog, enabled syslog -> feeds log gets routed there. +1 for this.

twistor’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Needs work

Err. We can't just check for dblog. It needs to be a separate variable, I guess. I don't see the use case for disabling it entirely, however.

aleksijohansson’s picture

Exactly what I needed. Feeds was filling the syslog and that made finding real issues very hard. Disabling feeds log with the variable works like a charm!

honza pobořil’s picture

@twistor What you recommend to do? Switch in Feeds settings (Log to feeds_log table / Log to Watchdog)?

megachriz’s picture

Status: Needs work » Needs review
Issue tags: +Needs tests
StatusFileSize
new4.75 KB

Maybe we could use a bitwise operator to control the log behavior. This way you could set a variable with which you can set to use the feeds_log table, watchdog or both. The attached patch implements this.

Usage:

  • Write to feeds_log table only (the default):
    variable_set('feeds_log_methods', FEEDS_LOG_DB);
  • Pass log entry to watchdog and do not write to the feeds_log table:
    variable_set('feeds_log_methods', FEEDS_LOG_WATCHDOG);
  • Write to feeds_log and to watchdog:
    variable_set('feeds_log_methods', FEEDS_LOG_DB | FEEDS_LOG_WATCHDOG);
  • Don't write the log message at all:
    variable_set('feeds_log_methods', '');

In the patch I've copied some code from the watchdog() function to avoid writing to dblog, as I think it isn't useful to write the message to both feeds_log and dblog and I figured that if you don't want to write to the feeds_log table, why would you want to write to dblog? So that's why I think writing to dblog should be skipped altogether. This is debatable, however.

Could use some automated tests, if this is an approved method to fix the issue.

bluegeek9’s picture

Status: Needs review » Closed (outdated)
//www.flaticon.com/free-icons/thank-you Thank you for your contribution!

Unfortunately, Drupal 7 is End of Life and no longer supported. We strongly encourage you to upgrade to a supported version of Drupal.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.