问题
Is there an Elmah equivalent for PHP in general, Symfony in particular?
回答1:
Symfony comes with a logging framework that can log to file or any other backend you care to give it. From my understanding of Elmah this is about as close as you can get - there's nothing with all the features available and integrated with frameworks such as Symfony.
Please see this chapter in the Symfony book for more information on Symfony's logging capabilities.
回答2:
For future reference, elmah.io can be used for PHP as well. We focus primarily on .NET, but some of our users use it for PHP as well. Take a look at the following example to start logging errors from PHP to elmah.io: https://github.com/elmahio/other-language-examples/blob/master/PHP/Logger.php
To make it clear, I'm the founder of elmah.io and elmah.io isn't affiliated with ELMAH in any way. We share the name, but the services are very different.
回答3:
error_log()
writes to system log etc.
You can search in PEAR as well...
回答4:
I'd recommend PEAR::Log as recommended by @Jet, along with set_error_handler() and set_exception_handler().
来源:https://stackoverflow.com/questions/951472/elmah-for-other-php