PHP Mailer not working when debugging is enabled but working if debugging is disabled? [closed]

How to use debugging of php mailer ?

when I use the debug option the mail is not working and I have an exception

$mail->SMTPDebug = 3;

but when I turn off the debug the mail is working

$mail->SMTPDebug = 0;

what is the cause ?