I’m writing two plugins at the moment which need to (optionally) log stuff…lots of stuff…somewhere. Since i don’t like the ‘you need to have proper permissions in this and that folder’ messages of some plugins, ideally, i’d like to do it in the database.
But before i start creating my own db tables (which is also something i don’t like for plugins to be doing), i’m wondering if WordPress has anything that could help with suchalike enterprise hidden in the dark deep of its codebase catacombs?
WordPress makes use of the reliable PHP error logging. It provides an API of it’s own and it’s fully documented here: Error Handling and Logging and often it’s already well integrated into server configurations.
For optional logging you can just use trigger_error() with it’s default error-type notice (E_USER_NOTICE).
Doing so will ensure you’re streamlined with wordpress error reporting and logging.
WordPress, does not have a logging API or something that does even close to that burried down deep in it’s spaghetti code. You can however make use of existing PHP based solutions that do provide high-level logging functionality like Apache Log4php which supports logging into different storages, incl. databases.
I created my own plugin and it’s now available from in the repository.
(Edit: The plugin moved to its new home under the right name, so packaging and auto-update should be fine.)
You can just use a hidden custom post type, like this plugin here:
http://wordpress.org/extend/plugins/log-deprecated-notices (It’s written by core developer Nacin).
I have just discovered WordPress Logging Service plugin. Screenshots looks promising, looks maintained and it’s at least past version 1.0.