Skip to content

Loading…

Add option to enable/disable logging. #3

Closed
wants to merge 1 commit into from

1 participant

@mzeis

Aoe_AsyncCache logs every job (mode, duration, tags) in system.log. This feature adds lines to our log which we don't need.

Therefore I added the option to disable logging for this information. Errors are still logged. By default logging stays enabled so the default behaviour is unchanged.

I didn't bump up the version number in case you want to handle this yourself.

@mzeis mzeis closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 29, 2013
  1. Added option to enable/disable logging.

    LimeSoda committed
View
4 app/code/community/Aoe/AsyncCache/Model/Cleaner.php
@@ -25,7 +25,9 @@ public function processQueue() {
$startTime = time();
Mage::app()->getCache()->clean($job['mode'], $job['tags'], true);
$job['duration'] = time() - $startTime;
- Mage::log('[ASYNCCACHE] MODE: ' . $job['mode'] . ', DURATION: ' . $job['duration'] . ' sec, TAGS: ' . implode(', ', $job['tags']));
+ if (Mage::getStoreConfigFlag('dev/log/aoeAsyncCacheActive')) {
+ Mage::log('[ASYNCCACHE] MODE: ' . $job['mode'] . ', DURATION: ' . $job['duration'] . ' sec, TAGS: ' . implode(', ', $job['tags']));
+ }
}
// delete all affected asynccache database rows
View
5 app/code/community/Aoe/AsyncCache/etc/config.xml
@@ -107,6 +107,11 @@
<scheduler_cron_expr>*/15 * * * *</scheduler_cron_expr>
</aoeasynccache>
</system>
+ <dev>
+ <log>
+ <aoeAsyncCacheActive>1</aoeAsyncCacheActive>
+ </log>
+ </dev>
</default>
</config>
View
17 app/code/community/Aoe/AsyncCache/etc/system.xml
@@ -34,5 +34,22 @@
</aoeasynccache>
</groups>
</system>
+ <dev>
+ <groups>
+ <log>
+ <fields>
+ <aoeAsyncCacheActive translate="label">
+ <label>Log Aoe_AsyncCache messages</label>
+ <frontend_type>select</frontend_type>
+ <source_model>adminhtml/system_config_source_yesno</source_model>
+ <sort_order>80</sort_order>
+ <show_in_default>1</show_in_default>
+ <show_in_website>1</show_in_website>
+ <show_in_store>1</show_in_store>
+ </aoeAsyncCacheActive>
+ </fields>
+ </log>
+ </groups>
+ </dev>
</sections>
</config>
Something went wrong with that request. Please try again.