Laravel Classroom image

Prashant  Nigam / Student / Web Technology

 
To post your Question Join Classroom
 
Lesson Topics's No:-  First|1 | 2 | 3|
Lessons:-Debugging Applications

23.3 Logging
Being able to show errors, and log them to files is handy, but what if we want to log our own
custom information? The Laravel Log class contains two different methods for logging useful
information from your application. Let’s take a look at these methods now.
The Log::write() method accepts a log type, and a string message to be written to the log file.
For example..
1 <?php
2
3 Log::write('myapp', 'Here is some useful information.');
Will result in the following line being written to the log file.
1 2012-05-29 19:10:17 MYAPP - Here is some useful information.
The entry will of course be written to the active log file in the storage/logs directory in a file
named after the current day, for example 2011-02-05.log. This allows for the logs to be rotated
and avoid having log files that are huge!
You can also use a magic method to set the log type, for example..
1 <?php
2
3 Log::shoe('my log entry');
Will have the same effect as..1 <?php
2
3 Log::write('shoe', 'my log entry');
Very useful!
Make use of all of the features you have learned in this chapter to diagnose your applications if
anything goes wrong!
I would like to thank the following wonderful people for buying a copy of the book!
• Marc Carson
• David Wosnitza AKA _druuuuuuuu
• Mark van der Waarde from Alsjeblaft!
• Joseph Wynn
• Alexander Karisson
• Victor Petrov
• Josh Kennedy
• Alexandru Bucur

 

 

 
 
 

Prashant  Nigam

Skills    Laravel

Qualifications :-
Location :-,,,
Description:-
Explore
 

  Students (0)