2

Unfortunatley we need to develop an Import plug-in helper with dev mode OFF, for - according to Brad at P&T:

devMode uses a lot more memory on a given PHP request and importing probably already requires significant memory, so my guess is that you're running into your php.ini file's memory_limit or max_execution_time limits or something similar.

The Import plug-in is definitely a resource pig. We can't get it to work at all in dev mode. But we need to develop a plug-in using its hooks to help with things it can't handle in our situation (tables, dates, switches) so we're in a tough spot.

According to this article:

If you want a log item to appear regardless of whether devMode is enabled, you can pass true as the third argument to the log() method.

SproutActivePlugin::log('Log this with or without devMode enabled.', LogLevel::Info, true);

Is this accurate?

We've tried it. Doesn't seem to work as advertised. Nothing in the logs unless dev mode is turned on. And when it's turned on the Import plug-in hangs up. We're in a tough spot.

What else should we be looking for? What else can we try?

Craft CMS 2.6.2930 / Import 0.8.28 / PHP 5.6.10

EDIT:
We have increased memory_limit 10 fold (1280M)
We have increased max_execution_time 100 fold (30000)
We have increased max_input_time 100 fold (60000)

2

If you want a log item to appear regardless of whether devMode is enabled, you can pass true as the third argument to the log() method.

Is this accurate?

Yes. Logs will only get flushed to disk is a proper craft()->end() occurs, firing the onEndRequest event. So if you're doing something in your plugin like calling PHP's exit() directly or there is some other logic that inadvertently kills the request, then they won't get written to the log file.

I'd suspect that's what you're running into.

  • Would the logs output fine with dev mode true? Because they do. I am trying to output logs from the Import modifyImportRow hook regardless of dev mode. – Steve Mock Sep 13 '16 at 21:17
  • And you're looking in craft/storage/runtime/logs/sproutactive.log? I just tested this in a test plugin's init method with TestPlugin::log('Log this with or without devMode enabled.', LogLevel::Info, true); and devMode disabled and got the expected 2016/09/13 23:19:27 [info] [plugin] [Forced] Log this with or without devMode enabled. in test.log. – Brad Bell Sep 13 '16 at 23:21
  • Yes, of course. If it ever gets written. But it doesn't. Something is screwy with the Import plug-in I think. – Steve Mock Sep 14 '16 at 0:55
  • I tried - as you - putting the line into the Import plug-in init method, and indeed works as expected. So something else is happening. Thanks for helping. – Steve Mock Sep 14 '16 at 1:10
  • Yeah, my guess is something in the plugin is improperly ending the request not giving Craft a chance to flush the logs. Still weird that it works fine with devMode on, though. – Brad Bell Sep 14 '16 at 2:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.