There are a variety of logging tools available for nearly every programming language under the soon.
Naturally, each of which provides its own set of features, advantages, and disadvantages, but sometimes a simple logger is fine for getting the job done, right?
MyLogPHP is a simple, easy-to-use, easy-to-install PHP logger.
It supports info messages, warning messages, error message, and debug messages. It’s easy to get started, too.
Simply include the file:
[cc lang=”php”]
include_once(‘MyLogPHP.class.php’);
[/cc]
Instantiate the logger object:
[cc lang=”php”]
$logger = new MyLogPHP(‘./log/debug.log’);
[/cc]
And you’re ready to begin recording messages:
[cc lang=”php”]
$logger->warning(‘The logger is writing a message to file!’);
[/cc]
It’s freely available – you can grab a copy and read the related documentation on the Google Code page.
Brian Notess says
You have a knack for posting tools that would have been really useful a few projects ago 😉
This seems a lot easier and safer that trying to mess with the php.ini file.
Tom McFarlin says
No time like the present, though. What you’re working on right now will be ‘a few projects ago.’ 😉
David Alan Hjelle says
It’s a little more complicated (but not much!) to set up, but ChromePHP http://www.chromephp.com/ lets you log from PHP to Chrome’s Developer Console. This is really handy.
I think there is a FireFox equivalent (perhaps the original) in FirePHP http://www.firephp.org/, but I’ve not used it.
Tom McFarlin says
Love this – thanks for sharing it. Sounds great for local development, for sure.