I want to write a custom log file which contains order and
timestamp in the log file.
Mage::log() but stops the file running afterwards and footer disappears.
Can anyone guide me in that?
Are you trying to combine the timestamp and order in one single log call. This would cause an error. Mage::log() actually prepends the timestamp so all you would need to do is:
Mage::log($order->getData(), null, 'custom.log', true);
$order in the case above is an instance of the order class.
If doesn't work then its likely to be another error. I would turn on error logging and check your system.log and exception.log files.
You could also turn on error_reporting and developer mode in the index.php file and see what error is been thrown.
You are trying to write the entire order object which will make the script to die. Just write only the data you need. For example