Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

SitePoint PHP Blog:
More Effective PHP Logging with Loggly
May 08, 2015 @ 16:54:13

The SitePoint PHP Blog has a new tutorial by Yones Rafie showing you how to log more effectively with Loggly, a remote log management service that's easy to connect to your PHP application. (Note: this post is sponsored by Loggly but it's still an interesting tool.)

When logging with PHP, we tend to use the error_log and trigger_error functions, or we can use an error handler to make the logging process more generic. [...] But what would you do if you had to log to multiple places at the same time, or you were sending logs to a given service depending on the error level? Rather than using built-in tools, it’s often easier to use logging libraries.

They go on to talk about logging using a PSR-3 compliant logger and show how to integrate the Loggly service with your application via one of the most popular options, Monolog. The integration is made even easier by the fact that Monolog already comes with a LogglyHandler built-in. The post includes the code you'll need to implement the logger, how to integrate it with a Laravel application, setting it up on Heroku and and a tour of the Loggly features for filtering, searching and examples of the graphs showing query results. Loggly is free to try out, so you can see if it will work for your application before making the commitment.

tagged: loggly logging psr3 monolog tutorial error laravel heroku interface example

Link: http://www.sitepoint.com/effective-php-logging-loggly/


Trending Topics: