If you want to print your code log in the custom log file, then use the below mention code to print the log in the custom log file.
$StringVar = 'Magemonkeys';
$ArrayVar = array('Magemonkeys', 'Abbacus');
$writer = new ZendLogWriterStream(BP . '/var/log/CustomFileName.log');
$logger = new ZendLogLogger();
$logger->addWriter($writer);
$logger->info('Lorem ipsum dolor sit amet...'); // For print simple text in custom log file
$logger->info($StringVar); // For print string in custom log file
$logger->info(print_r($ArrayVar, true)); // For print array in custom log file
That’s it.
Refresh your page and see your custom log file in Magento /var/log directory. Hope that helps.

