Shivam Sharma
Shivam Sharma

Reputation: 1

Facing issue to integrate laravel error log features in my project

I am facing issue to integrate laravel error log features in my project, I am fresher, if anybody has some idea please share with me. I had also used arcendev package but, I have no proper documentation about that so, it was difficult for me to understand functionality of arcendev package.

Upvotes: 0

Views: 31

Answers (1)

bhucho
bhucho

Reputation: 3420

you can use the following code snippet as reference. First you should import

use Illuminate\Support\Facades\Log;

As you have mentioned that you want to use log to show errors If you are using try catch blocks to handle errors you can put log error in your catch for exceptions.

 catch(Exception $e){
        $error['error'] = $e->getMessage();
        $error['inputs'] = $request->all();
        Log::info('My Error Message',$error);
    }

By default, the message will be written to the default log channel as configured by your config/logging.php configuration file.

You can also use Log::error($message); to keep track of log messages.

Check here for more logging messages.

Upvotes: 0

Related Questions