In reply to djsteveb.

Those solutions are painful because they require both that the normal bootstrapping and startup of wordpress occurs, but also then that additional resources are spent to open a db connection for logging, and for checking incoming requests. That makes the cure almost worst than the cause, and makes it much easier for your machine to be DDoS'ed by someone just trying to spam you.