\Magento\Framework\App\ObjectManager::getInstance()
->get(\Psr\Log\LoggerInterface::class)->debug('message');
For custom .log file:
$writer = new \Zend_Log_Writer_Stream(BP . '/var/log/debugSql.log');
$logger = new \Zend_Log();
$logger->addWriter($writer);