11

I would like to know the below 2 locations of Magento 1 in Magento 2. Where can I find these 2 locations in Magento 2 Admin Panel ?

First location

enter image description here

Second location

enter image description here

2 Answers 2

15

Unfortunately, those options are gone now in Magento.

Regarding the visitor log, everything is logged via the \Magento\Customer\Model\Logger model and via events observers declared under \Magento\Customer\etc\frontend\events.xml.

However, the automatic cleaning seems to be totally gone.

Regarding the system and exceptions logs, same issue, it's not configurable via the backend anymore and it's hardcoded directly in the following classes:

  • \Magento\Framework\Logger\Handler\Debug.php when you use the debug level, logs will go to /var/log/debug.log
  • \Magento\Framework\Logger\Handler\Exception.php when you use the exception level, logs will go to /var/log/exception.log
  • \Magento\Framework\Logger\Handler\System.php when you use the system level, logs will got to /var/log/system.log
4
  • Then, how can we use custom logging? Lets say if I want to do something like this: Mage::log($collectionData, null, 'collectionData.log'); How can I check my logs? Sep 23, 2016 at 4:13
  • @AbhishekDhanrajShahdeo I suggest you check this question: magento.stackexchange.com/questions/92434/… Sep 23, 2016 at 6:30
  • is there any way to disable it ? i want to disable system log permanently Apr 18, 2020 at 9:52
  • So, the definitive answer is no? Is no way to disable or clean the logs? That sounds pretty impractical. Why the change? Feb 4, 2021 at 16:11
-2

If you want to log your variables you can do this way.

<?php
namespace Test\Testpayment\Observer;

class Sendtogateway implements \Magento\Framework\Event\ObserverInterface
{
  protected $_responseFactory;
  protected $_url;
  protected $order;
  protected $logger;
  protected $_checkoutSession;

    public function __construct(
        \Magento\Framework\App\ResponseFactory $responseFactory,
    \Magento\Framework\UrlInterface $url,
    \Magento\Sales\Api\Data\OrderInterface $order,
        \Psr\Log\LoggerInterface $loggerInterface,
    \Magento\Checkout\Model\Session $checkoutSession
    ){
        $this->_responseFactory = $responseFactory;
    $this->_url = $url;
    $this->order = $order;
        $this->logger = $loggerInterface;
    $this->_checkoutSession = $checkoutSession;
    }

  public function execute(\Magento\Framework\Event\Observer $observer)
  {

     $id = $observer->getEvent()->getOrder()->getIncrementId();
     $this->_checkoutSession->setOrderNo($id);
     $orderdetail = $this->order->loadByIncrementId($id);
     $customerBeforeAuthUrl = $this->_url->getUrl('testpay/index/index/');
     $this->_responseFactory->create()->setRedirect($customerBeforeAuthUrl)->sendResponse();
     $this->logger->debug('$id');
  }
}
2
  • This answer not belong to the question
    – Asish Hira
    Nov 3, 2018 at 4:22
  • It is not the correct way. Oct 18, 2019 at 6:11

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.