Bug #17349 Statements from events are not logged in general_log
Submitted: 13 Feb 2006 18:03 Modified: 13 Feb 2006 18:13
Reporter: Markus Popp Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.1.7-beta OS:Linux (SuSE Linux 10.0)
Assigned to: CPU Architecture:Any

[13 Feb 2006 18:03] Markus Popp
Description:
If you create an event, the statements that are executed from the event are not logged in the general_log (other logs as well?).

How to repeat:
E:\mysql_dump>mysql -h 10.2.4.1 -P 3307
Enter password: *******
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 115 to server version: 5.1.7-beta-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> use test
Database changed
mysql> delimiter //
mysql>
mysql> DROP EVENT IF EXISTS insertIntoTt //
Query OK, 1 row affected (0.00 sec)

mysql>
mysql> CREATE EVENT insertIntoTt
    -> ON SCHEDULE EVERY 5 SECOND
    -> STARTS current_timestamp + INTERVAL 5 SECOND
    -> ON COMPLETION PRESERVE
    -> DISABLE
    -> DO
    -> BEGIN
    ->   INSERT INTO test.tt (d) VALUES (floor(rand() * 20));
    -> END //
Query OK, 1 row affected (0.00 sec)

mysql>
mysql> delimiter ;
mysql> DROP TABLE IF EXISTS `test`.`tt`;
Query OK, 0 rows affected (0.00 sec)

mysql> CREATE TABLE  `test`.`tt` (
    ->   `id` int(10) unsigned NOT NULL auto_increment,
    ->   `d` int(10) unsigned NOT NULL,
    ->   `ts` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
    ->   PRIMARY KEY  (`id`)
    -> ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Query OK, 0 rows affected (0.00 sec)

mysql> SELECT @@event_scheduler;
+-------------------+
| @@event_scheduler |
+-------------------+
|                 1 |
+-------------------+
1 row in set (0.00 sec)

mysql> ALTER EVENT insertIntoTt ENABLE;
Query OK, 1 row affected (0.00 sec)

mysql> select current_time(), count(*) from test.tt;
+----------------+----------+
| current_time() | count(*) |
+----------------+----------+
| 18:55:34       |        5 |
+----------------+----------+
1 row in set (0.00 sec)

mysql> select current_time(), count(*) from test.tt;
+----------------+----------+
| current_time() | count(*) |
+----------------+----------+
| 18:55:43       |        7 |
+----------------+----------+
1 row in set (0.00 sec)

The INSERT statement from the EVENT is being executed, but it doesn't show up the general query log.

Suggested fix:
Commands from inside an event should be logged, too.
[13 Feb 2006 18:13] Andrey Hristov
See bug #16413.
You can search for all known bugs in the Category -> MySQL Server::Event Scheduler

Thanks!