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?

Ta.

4 Answers
4

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.

Leave a Reply

Your email address will not be published. Required fields are marked *