Answers:
不幸的是,这些选项现在已经在Magento中消失了。
关于访问者日志,所有信息均通过\Magento\Customer\Model\Logger
模型以及在下声明的事件观察器进行记录\Magento\Customer\etc\frontend\events.xml
。
但是,自动清洁似乎已完全消失。
关于系统日志和异常日志,同样的问题,它不再可以通过后端进行配置,并且直接硬编码在以下类中:
\Magento\Framework\Logger\Handler\Debug.php
当您使用调试级别时,日志将转到 /var/log/debug.log
\Magento\Framework\Logger\Handler\Exception.php
当您使用异常级别时,日志将转到 /var/log/exception.log
\Magento\Framework\Logger\Handler\System.php
当您使用系统级别时,日志将转到 /var/log/system.log
如果要记录变量,则可以这样做。
<?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');
}
}