1

I'm having this weird issue that both of my custom plugin logs are not working but all other third party ones including craft.log work fine. By 'not working' I mean the log file is generated, but empty.

Another weird thing is the issue only happens on production environment. Tested on local environment and staging environment, they all work fine.

I believe I got the code right?

MyPlugin::log("Errors:\n\n" . print_r($fieldsData, true), LogLevel::Error);

It's Craft 2 by the way.

Anything ideas?

2
  • Weird... I'm assuming devMode is not enabled in production. Is it locally and in staging?
    – Brad Bell
    Commented Nov 28, 2018 at 6:30
  • devMode is enabled locally, but disabled on staging and production. Weird, huh? Anyway, forcing log param did the trick.
    – Wei
    Commented Dec 3, 2018 at 4:32

1 Answer 1

2

Put the force parameter to true

MyPlugin::log("Errors:\n\n" . print_r($fieldsData, true), LogLevel::Error, true);

Custom Log in Craft

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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