How to log errors in try/catch statement laravel?
<p>Im performing a try catch statement where I need the code to do something and if it fails catch the error, log it to the laravel log file and continue with the loop. My code is: </p>

<pre><code>    foreach ($logins as $login) {
        try {
            // Do something here
        } catch (Exception $e) {
            // Log errors
            \Log::error( $e-&gt;getMessage() );
            continue;
        }
    }  
</code></pre>

<p>But I am getting an error that reads </p>

<pre><code>[Symfony\Component\Debug\Exception\FatalErrorException]                           
Namespace declaration statement has to be the very first statement in the script 
</code></pre>

<p>I've used \Log:: in the name space and also tried adding the <code>use Log;</code> but I still get this error. </p>