You are viewing an old revision of this post, from December 16, 2019 @ 18:49:46. See below for differences between this version and the current revision.

Magento 2 – Write logs to the custom files

In Magento 2, you can use the following code to write logs to the custom files

$writer = new \Zend\Log\Writer\Stream(BP . '/var/log/templog.log');
$logger = new \Zend\Log\Logger();
$logger->addWriter($writer);

$logger->info("Log info: ".  $e->getMessage());

Revisions

  • December 16, 2019 @ 18:49:47 [Current Revision] by Sharing Solution
  • December 16, 2019 @ 18:49:46 by Sharing Solution

Revision Differences

There are no differences between the December 16, 2019 @ 18:49:46 revision and the current revision. (Maybe only post meta information was changed.)

No comments yet.

Leave a Reply