Skip to main content
Share Your Experience: Take the 2024 Developer Survey
51 votes
Accepted

Logging in Magento 2.4+

This will work with the newest Magento 2.4.3+: $writer = new \Zend_Log_Writer_Stream(BP . '/var/log/custom.log'); $logger = new \Zend_Log(); $logger->addWriter($writer); This is just ...
magento4u_com's user avatar
13 votes
Accepted

Debugging ui components

What I found so far is that when rendering the layout this stack is followed. \Magento\Framework\View\Layout::generateElements \Magento\Framework\View\Layout\GeneratorPool::process Now, ...
Marius's user avatar
  • 198k
12 votes

Logging in Magento 2.4+

There are many ways to log messages currently and they are described below. Please do add on to this as a knowledge base. Log to the existing Magento log files in var/log/ This is done using Psr\Log\...
Adarsh M's user avatar
  • 594
10 votes

Whats the purpose of lockedLoadData / uncached page build takes around a minute, spent in usleep

Well that's a -- choice? -- the Magento engineers made. This isn't an answer, but it looks like that function accepts a callback that's meant to load cached data. The callback checks if there's ...
Alana Storm's user avatar
  • 44.4k
9 votes

What are the top useful Phpstorm plugins for Magento 2 development?

1) PHPStorm with XDebug: PHPStorm is my favorite IDE. It is an advanced IDE for PHP developers. Many developers still use only var_dump and die to debug the system. From my experience, these ...
Khoa TruongDinh's user avatar
9 votes
Accepted

Some very few images are rendered with inverted colors by Magento

This could be down to the image being in the CMYK colour space, Imagick can have issues when working with these images as it is unable to convert to RGB properly. You can either upload a ...
MageIdiot's user avatar
  • 138
9 votes

Whats the purpose of lockedLoadData / uncached page build takes around a minute, spent in usleep

lockedLoadData mechanism needs to decrease the load on the server. Previously when configuration cache is cleaned on hi-loaded sites all client has generated the same information that significantly ...
KAndy's user avatar
  • 20.9k
8 votes

Logging in Magento 2.4+

After the release of the Magento 2.4.3 version, the Laminas-log module is removed. Thus, the previous method by using $writer = new \Laminas\Log\Writer\Stream(BP . $path); $logger = new \...
Derek Lee's user avatar
6 votes
Accepted

Magento 2 Developer Toolbars

I tested the best developer toolbars, I'll put down the more I liked it. ADM/QuickDevBar Info : Information about controller, route, action and store. A dedicated tab output a phpinfo. Design : ...
Rafael Corrêa Gomes's user avatar
6 votes

Magento log is not writing in log folder

There are several possible options here: Logs have been disabled under System > Configuration > Developer > Log Settings > Enabled Your server is full and thus can't write to the logs anymore. Maybe ...
Raphael at Digital Pianism's user avatar
6 votes
Accepted

Is there any way to identify what class causes 'Area code is not set' or 'Area code already set'?

So. First, thanks to @SwAt.Be, he's pushed me to the right way. Second, Magento 2 DI debug is really sucks. I hope the guys from Magento ever fix it. Preamble Some of the core models requires Area ...
spiilmusic's user avatar
6 votes
Accepted

You need to choose options for your item even if option is chosen - Magento 2

You need to check what parameters we are sending in post data.when we select color and size so it select their option id and these option id sent in post data.So you need to check Post data in ...
Shubham Khandelwal's user avatar
6 votes

Magento 2 PHPSTORM Xdebug Configuration setup

I have setup Xdebug for PHPSTORM in Linux system these are the steps. Step 1 :- sudo apt-get install php-xdebug Xdebug installation is up to you and after that please insure Xdebug is installed . ...
Manish Goswami's user avatar
6 votes

How to put log in observer Magento 2

Try Below Code: Check LoggerInterface to debug <?php namespace Custom\Module\Observer; use \Magento\Framework\Event\ObserverInterface; use \Magento\Framework\Event\Observer; class Index ...
Devidas's user avatar
  • 3,358
6 votes
Accepted

Magento 2 How to create log of upgrade command?

You can use below command: bin/magento setup:upgrade >> /var/www/html/magento2/var/log/update.cron.log It may help you.
Sweety Masmiya's user avatar
5 votes
Accepted

Use the Magento 2 profiler in CLI

Is there another, more standard way to profile CLI calls? Apparently not, so I'll add my workaround as an answer: HTTP_ACCEPT="text/html" MAGE_PROFILER=csvfile bin/magento
Fabian Schmengler's user avatar
5 votes

What are the top useful Phpstorm plugins for Magento 2 development?

Magicento help for development (printscreen).
St3phan's user avatar
  • 2,907
5 votes

Which server settings can cause Magento reindex to run really slow?

And another Answer --- thanks to the Chat with Wilson Hauck: He pointed out, that the quotes might confuse the new optimized in 10.3 I took the full query.sql from above and extracted only the ...
Alex's user avatar
  • 13.8k
5 votes
Accepted

Which server settings can cause Magento reindex to run really slow?

@Alex In your value list of id's to be managed, the quotes are likely causing the processing to work harder than when you use simply the number to be managed as an INT data type. If you find this ...
Wilson Hauck's user avatar
4 votes
Accepted

Tracking down DEBUG logged entries

Find out which URL is triggering the log Edit app/Mage.php and replace the following code under the log() method: $loggers[$file]->log($message, $level); With: $loggers[$file]->log(self::$...
Raphael at Digital Pianism's user avatar
4 votes

Magento log is not writing in log folder

In 1.9.4.1 (or after applying SUPEE-11086 patch) if you delete "/var/log/system.log" log file becomes "not writeable" (even if directory is writeable), so Magento skips writing log. Solution: make ...
user default's user avatar
4 votes

What's your way of debugging xml related exceptions?

The exception thrown tells you that you're using an element <item /> where your not allowed to use one. So yeah, your problem is probably XML-related. The first thing I do to make sure I write ...
Giel Berkers's user avatar
  • 12.3k
4 votes
Accepted

Get source xml of error

I think the answer is no. :( If you trying to debug the Magento\Framework\Config\Dom class you can see that all data has stored in the memory as a one big file, which leads to unknown place (in my ...
Siarhey Uchukhlebau's user avatar
4 votes

How to debug php which is run by cron job only

You could use Magerun. Magerun contains a command through which you can manually trigger a cronjob. use the following command and then select a number for the specific job: Magento 1 n98-magerun....
Mr. Lewis's user avatar
  • 1,931
4 votes

How to debug php which is run by cron job only

Create a new file, for example, test.php and put it in your magento2 pub directory with the following code: <?php require __DIR__ . '/../app/bootstrap.php'; class TestMyClass extends \Magento\...
BioB's user avatar
  • 41
4 votes
Accepted

Magento 2 debugging js ui component in browser

I made one solution after working on jquery function calling into console line by line. As per debugging form data by uiRegistry https://devdocs.magento.com/guides/v2.2/ui_comp_guide/concepts/...
Himanshu's user avatar
  • 1,761
3 votes

Magento 2 build in modules/functionality investigation workflow

This is a great question. I'll detail what I'm doing/have done in situations like this. For what it's worth, this basically the method I used to get my Magento Certified Developer and Magento ...
tjons's user avatar
  • 1,831
3 votes

What's the best way to debug Magento?

This might not be the best solution, however, its the way I debug stuff on Magento 2. First of all, switch to Developer mode. You can do this via the console: $ php bin/magento deploy:mode:set ...
Max's user avatar
  • 1,844
3 votes
Accepted

Magento 1.9 - Order object passed to event observer is empty

The object is not empty, it is just to large to write it to logfile. This breaks the observer method and your last Mage::log('function end') is not reached. For debugging of large objects you should ...
sv3n's user avatar
  • 11.7k

Only top scored, non community-wiki answers of a minimum length are eligible