//Full path to the log file:
$logPath = Mage::getConfig()->getOptions()->getVarDir().DS.$file_name.time().'.xml';
//Layout model: Mage_Core_Model_Layout
$layout = Mage::getSingleton('core/layout');
//Generate our xml with Mage_Core_Layout_Update model and save it in a file
$xml = '<'.'?xml version="1.0"?'.'>';
$xml .= '<layout>'.trim($layout->getUpdate()->asString()).'</layout>';
file_put_contents($logPath, $xml);