Per T525, Sentry seems the most mature FOSS error logging software. We should set up a test instance - as unlikely as it is to scale up to the traffic of WMF sites, it would spare us a lot of development time if it still does. And even if it does not, it's commercial-quality error logging code and reviewing it will help us figure out how to build our own error logger.
Also, while we are at it, we could probably try to use it to log PHP errors (and whatever else there is) as well.