0

I am attempting to build a custom payment module but as far as I got I get the error message sh: -t not found when checking out a test order I saw this question but the link in the answer is broken, I cannot place comments and didn't feel appropriate to answer with a question so here I am.

If there are some pointers to how Magento module should be debugged in these cases, usually there get a big dump of a log it hard to see what I'm looking for

EDIT: taking the code from this answer the log file created but is empty, putting it after all operations of the of an particular variable is executed results in some output. It appears i need to figure out which variable to debug, as well as the point where i should put the code


1 Answer 1

2

You can use this code in a phtml or php file and it will log the dump of $order->debug() in var/log/payment-method.log

$logger = new \Zend\Log\Logger();
$logger->addWriter(new \Zend\Log\Writer\Stream(BP.'/var/log/payment-method.log'));
$logger->debug(print_r($order->debug(),1));
6
  • ohw cool i guess i can put this in any of the php files involved in the payment module?
    – Fuseteam
    Jun 23, 2020 at 11:37
  • Yeah, you can use it in any php/phtml file, maybe you need to change $order->debug() for whatever var you need to debug
    – SantiBM
    Jun 23, 2020 at 16:08
  • ah i see, i'll check where i can make use of this
    – Fuseteam
    Jun 23, 2020 at 18:07
  • i finally found where i get the actual error 500 i added the code inside the execute function aaaand the log is empty :x did i miss anything?
    – Fuseteam
    Jul 2, 2020 at 12:08
  • so if the log file is created, the logging code is reached, maybe the variable you are trying to log is empty? You should add your findings to your question so we can see more information
    – SantiBM
    Jul 2, 2020 at 12:26

Your Answer

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

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