WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm developing a WordPress plugin, and have no other plugins installed.

The logging function is as simple as

function log($message){
    global $wpdb;
    $message = $wpdb->escape($message);
    $wpdb->query("INSERT INTO {$this->db['log']} (message) VALUES ('{$message}');"); 

Since the $wpdb->query didn't do anything but@mysql_query( $query, $this->dbh ); did, I'm not sure if this question is about wordpress.

source code http://xref.yoast.com/trunk/nav.html?wp-includes/wp-db.php.source.html#l1053

Plugin workflow:

1) Gather a list of events.

2) Loop the list.

3) Process each event. The function log will be invoked here when someting important should be logged such as "file is saved in /path/".

4) Stop

The whole work flow will take about 2 minutes to finish.

The log function is invoked 75 times while running. However, no log entry is found in the database while running.

When the plugin completes execution, those log entries are inserted and can be seen from database table.

What can I do that will insert log entry to database on the fly?

Thanks in advance.

share|improve this question

closed as too localized by toscho Jul 16 '12 at 23:10

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

Browse other questions tagged or ask your own question.