Yorum satırları okumanız yeterlidir.
// normal exception yapısından newLog u türetiyoruz.
class newLog extends Exception 
{
	//kurucu metodu başlatıyoruz ve metod içine dışarıdan veya o an kullanıcağımız değişkenleri üretiyoruz.
	public function __construct($message,$code=0,Exception $previous =NULL) {
		//Buna ne gerek var ? Ana metoddan kurucu metodu alıyor sanırım fakat {} lerin içinde olduğu için yazmaya ne gerke var ? 
		parent::__construct($message,$code);
	
			# code...
		
		$hata_mesaji ="Tarih : ". date("Y-m-d H:i:s")."\r\n";
		$hata_mesaji ="Dosya : ". parent::getFile(). "\r\n";
		$hata_mesaji ="Satır : ". parent::getLine(). "\r\n";
		$hata_mesaji ="Mesaj : ". parent::getMessage(). "\r\n\r\n";
		$dosya=fopen('hata.php', 'a');
		fwrite($dosya, $hata_mesaji);
		fclose($dosya);
		
		
		
	}
}
$a=5;
$b=0;
try {
	if (!@$sonuc=$a/$b) {
		# code...
		throw new newLog("Error Processing Request");
		
	}
}catch (newLog $hata) {
	// neden sadece getmessage() yi alıyoruz?
	echo $hata->getMessage();
	
}
?>
Sorun çözüldü dileyen olursa kullanabilir.
class newLog extends Exception 
{
	function __construct ($message) {
		parent::__construct($message);
		$hata_mesaji = "Tarih = ".date('Y-m-d H:i:s')."\r\n";
		$hata_mesaji .= "Dosya = ".parent::getFile()."\r\n";
		$hata_mesaji .= "Satir = ".parent::getline()."\r\n";
		$hata_mesaji .= "Mesaj = ".parent::getMessage();
		$dosya=fopen("hata.txt", 'a');
		fwrite($dosya, $hata_mesaji);
		fclose($dosya);
	} 
}
 
  
