class World extends \Magento\Framework\App\Action\Action
{
protected $logger;
public function __construct(Context $context, \Psr\Log\LoggerInterface $logger)
{
$this->logger = $logger;
return parent::__construct($context);
}
public function execute()
{
$this->logger->addDebug("TEST");
}
}
In Magento 1 the controller action executes always when we go to the corresponding url. But in magento 2 "Test" gets logged only when i clear my cache and go to the controller url otherwise it doesn't. How can i add it to a controller in magento 2 so that it will keep on executing the code when i go to the corresponding url, without clearing the cache, like magento 1.