Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I am using Laravel 3.2.13, I don't want to show errors to my users so I hide them and set:

/config/error.php

'log' => true

The log is working but it is not very readable, I would like to add some custom information like the current page $_SERVER["REQUEST_URI"] or the session user_id Session::get('id').

Where can I do this?

share|improve this question

1 Answer

up vote 1 down vote accepted

The proper way to do that in Laravel 3.2.13 without touching the source is by listen to the event laravel.log:

Event::listen('laravel.log', function($type, $message)
{
    $message = $type.' ['.$_SERVER["REQUEST_URI"].'] '.$message;
    File::append(path('storage').'logs/'.date('Y-m-d').'.log', $message);
});

Note that when listening to this event it will prevent from Laravel's log to write the line to the file, so you are aware of if.

For more information check the source of Log.php for Laravel 3.2.13

share|improve this answer
Perfect, i juste made some adjust for get the same look at the original paste.laravel.com/vIZ , thanks. – Tahola 2 days ago
1  
Glad to help you @Tahola. – Rubens Mariuzzo 2 days ago

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.