Merge lp:~miguelaraujo/mysql-proxy/loaded-plugins-logging into lp:mysql-proxy/0.8

Proposed by Miguel Araújo
Status: Superseded
Proposed branch: lp:~miguelaraujo/mysql-proxy/loaded-plugins-logging
Merge into: lp:mysql-proxy/0.8
Diff against target: 125 lines (+28/-9)
8 files modified
plugins/admin/admin-plugin.c (+1/-1)
plugins/cli/cli-plugin.c (+2/-2)
plugins/debug/debug-plugin.c (+1/-1)
plugins/proxy/proxy-plugin.c (+1/-1)
plugins/replicant/replicant-plugin.c (+1/-1)
src/chassis-frontend.c (+14/-0)
src/chassis-frontend.h (+5/-0)
src/mysql-proxy-cli.c (+3/-3)
To merge this branch: bzr merge lp:~miguelaraujo/mysql-proxy/loaded-plugins-logging
Reviewer Review Type Date Requested Status
Jan Kneschke (community) Needs Fixing
Review via email: mp+87352@code.launchpad.net

This proposal has been superseded by a proposal from 2012-01-23.

Description of the change

Updated plugins chassis name value;
Added logging for the loaded plugins.

To post a comment you must log in.
Revision history for this message
Jan Kneschke (jan-kneschke) wrote :

1) don't prefix all plugin names by "MySQL" when logging. It is up to the plugin to define its full name it wants to announce

2) remove the CHASSIS_NEWLINE from the g_critical() to get rid of the double newline. g_critical() (as all g_log() functions) always adds a newline itself.

review: Needs Fixing
1229. By Miguel Araújo

Removed "MySQL" prefix when logging loaded plugins names, and unnecessary CHASSIS_NEWLINE;

Revision history for this message
Jan Kneschke (jan-kneschke) wrote :

After a 2nd thought: stick with the old plugin names (proxy, debug, ...) and log it as:

  g_critical("plugin %s %s started", p->name, p->version);

review: Needs Fixing
1230. By Miguel Araújo

Reverted to old plugin names and altered logging message sintax

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'plugins/admin/admin-plugin.c'
--- plugins/admin/admin-plugin.c 2011-08-30 14:58:00 +0000
+++ plugins/admin/admin-plugin.c 2012-01-23 16:53:27 +0000
@@ -618,7 +618,7 @@
618618
619G_MODULE_EXPORT int plugin_init(chassis_plugin *p) {619G_MODULE_EXPORT int plugin_init(chassis_plugin *p) {
620 p->magic = CHASSIS_PLUGIN_MAGIC;620 p->magic = CHASSIS_PLUGIN_MAGIC;
621 p->name = g_strdup("admin");621 p->name = g_strdup("Proxy Admin");
622 p->version = g_strdup(PACKAGE_VERSION);622 p->version = g_strdup(PACKAGE_VERSION);
623623
624 p->init = network_mysqld_admin_plugin_new;624 p->init = network_mysqld_admin_plugin_new;
625625
=== modified file 'plugins/cli/cli-plugin.c'
--- plugins/cli/cli-plugin.c 2010-04-06 14:26:51 +0000
+++ plugins/cli/cli-plugin.c 2012-01-23 16:53:27 +0000
@@ -556,8 +556,8 @@
556int plugin_init(chassis_plugin *p) {556int plugin_init(chassis_plugin *p) {
557 /* append the our init function to the init-hook-list */557 /* append the our init function to the init-hook-list */
558 p->magic = CHASSIS_PLUGIN_MAGIC;558 p->magic = CHASSIS_PLUGIN_MAGIC;
559 p->name = g_strdup("cli");559 p->name = g_strdup("Proxy Client");
560 p->version = g_strdup("0.7.0");560 p->version = g_strdup(PACKAGE_VERSION);
561561
562 p->init = network_mysqld_cli_plugin_init;562 p->init = network_mysqld_cli_plugin_init;
563 p->get_options = network_mysqld_cli_plugin_get_options;563 p->get_options = network_mysqld_cli_plugin_get_options;
564564
=== modified file 'plugins/debug/debug-plugin.c'
--- plugins/debug/debug-plugin.c 2010-09-02 12:56:11 +0000
+++ plugins/debug/debug-plugin.c 2012-01-23 16:53:27 +0000
@@ -429,7 +429,7 @@
429429
430G_MODULE_EXPORT int plugin_init(chassis_plugin *p) {430G_MODULE_EXPORT int plugin_init(chassis_plugin *p) {
431 p->magic = CHASSIS_PLUGIN_MAGIC;431 p->magic = CHASSIS_PLUGIN_MAGIC;
432 p->name = g_strdup("debug");432 p->name = g_strdup("Proxy Debug");
433 p->version = g_strdup(PACKAGE_VERSION);433 p->version = g_strdup(PACKAGE_VERSION);
434434
435 p->init = network_mysqld_debug_plugin_new;435 p->init = network_mysqld_debug_plugin_new;
436436
=== modified file 'plugins/proxy/proxy-plugin.c'
--- plugins/proxy/proxy-plugin.c 2011-09-21 18:48:19 +0000
+++ plugins/proxy/proxy-plugin.c 2012-01-23 16:53:27 +0000
@@ -2221,7 +2221,7 @@
22212221
2222G_MODULE_EXPORT int plugin_init(chassis_plugin *p) {2222G_MODULE_EXPORT int plugin_init(chassis_plugin *p) {
2223 p->magic = CHASSIS_PLUGIN_MAGIC;2223 p->magic = CHASSIS_PLUGIN_MAGIC;
2224 p->name = g_strdup("proxy");2224 p->name = g_strdup("Proxy");
2225 p->version = g_strdup(PACKAGE_VERSION);2225 p->version = g_strdup(PACKAGE_VERSION);
22262226
2227 p->init = network_mysqld_proxy_plugin_new;2227 p->init = network_mysqld_proxy_plugin_new;
22282228
=== modified file 'plugins/replicant/replicant-plugin.c'
--- plugins/replicant/replicant-plugin.c 2011-08-30 14:58:00 +0000
+++ plugins/replicant/replicant-plugin.c 2012-01-23 16:53:27 +0000
@@ -822,7 +822,7 @@
822822
823G_MODULE_EXPORT int plugin_init(chassis_plugin *p) {823G_MODULE_EXPORT int plugin_init(chassis_plugin *p) {
824 p->magic = CHASSIS_PLUGIN_MAGIC;824 p->magic = CHASSIS_PLUGIN_MAGIC;
825 p->name = g_strdup("replicant");825 p->name = g_strdup("Proxy Replicant");
826 p->version = g_strdup(PACKAGE_VERSION);826 p->version = g_strdup(PACKAGE_VERSION);
827 /* append the our init function to the init-hook-list */827 /* append the our init function to the init-hook-list */
828828
829829
=== modified file 'src/chassis-frontend.c'
--- src/chassis-frontend.c 2011-10-13 10:56:04 +0000
+++ src/chassis-frontend.c 2012-01-23 16:53:27 +0000
@@ -524,6 +524,20 @@
524 lua_close(L);524 lua_close(L);
525}525}
526526
527/**
528 * log the versions of the initialized plugins
529*/
530int chassis_frontend_log_plugin_versions(GPtrArray *plugins) {
531 guint i;
532
533 for (i = 0; i < plugins->len; i++) {
534 chassis_plugin *p = plugins->pdata[i];
535
536 g_critical("%s %s started", p->name, p->version);
537 }
538
539 return 0;
540}
527541
528int chassis_frontend_write_pidfile(const char *pid_file, GError **gerr) {542int chassis_frontend_write_pidfile(const char *pid_file, GError **gerr) {
529 int fd;543 int fd;
530544
=== modified file 'src/chassis-frontend.h'
--- src/chassis-frontend.h 2010-07-07 07:57:26 +0000
+++ src/chassis-frontend.h 2012-01-23 16:53:27 +0000
@@ -151,6 +151,11 @@
151CHASSIS_API void chassis_frontend_print_lua_version();151CHASSIS_API void chassis_frontend_print_lua_version();
152152
153/**153/**
154 * log the versions of the initialized plugins
155*/
156CHASSIS_API int chassis_frontend_log_plugin_versions(GPtrArray *plugins);
157
158/**
154 * write the PID to a file159 * write the PID to a file
155 *160 *
156 * @param pid_file name of the PID file161 * @param pid_file name of the PID file
157162
=== modified file 'src/mysql-proxy-cli.c'
--- src/mysql-proxy-cli.c 2011-09-08 09:13:48 +0000
+++ src/mysql-proxy-cli.c 2012-01-23 16:53:27 +0000
@@ -564,10 +564,10 @@
564 }564 }
565 }565 }
566566
567 /* the message has to be _after_ the g_option_content_parse() to 567 /*
568 * hide from the output if the --help is asked for568 * log the versions of all loaded plugins
569 */569 */
570 g_message("%s started", PACKAGE_STRING); /* add tag to the logfile (after we opened the logfile) */570 chassis_frontend_log_plugin_versions(srv->modules);
571571
572#ifdef _WIN32572#ifdef _WIN32
573 if (chassis_win32_is_service()) chassis_win32_service_set_state(SERVICE_RUNNING, 0);573 if (chassis_win32_is_service()) chassis_win32_service_set_state(SERVICE_RUNNING, 0);

Subscribers

People subscribed via source and target branches