How to print any variable or text using php into log file in Magento 2 ( Adobe commerce )?

Just use these code lines for your code

 

 $objectmanager = \Magento\Framework\App\ObjectManager::getInstance();
    $objectmanager->get(‘Psr\Log\LoggerInterface’)->info(‘Testing Log’); //Print log in var/log/system.log
    $objectmanager->get(‘Psr\Log\LoggerInterface’)->debug(‘Testing Log’); //Print log in var/log/debug.log