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
1=== modified file 'plugins/admin/admin-plugin.c'
2--- plugins/admin/admin-plugin.c 2011-08-30 14:58:00 +0000
3+++ plugins/admin/admin-plugin.c 2012-01-23 16:53:27 +0000
4@@ -618,7 +618,7 @@
5
6 G_MODULE_EXPORT int plugin_init(chassis_plugin *p) {
7 p->magic = CHASSIS_PLUGIN_MAGIC;
8- p->name = g_strdup("admin");
9+ p->name = g_strdup("Proxy Admin");
10 p->version = g_strdup(PACKAGE_VERSION);
11
12 p->init = network_mysqld_admin_plugin_new;
13
14=== modified file 'plugins/cli/cli-plugin.c'
15--- plugins/cli/cli-plugin.c 2010-04-06 14:26:51 +0000
16+++ plugins/cli/cli-plugin.c 2012-01-23 16:53:27 +0000
17@@ -556,8 +556,8 @@
18 int plugin_init(chassis_plugin *p) {
19 /* append the our init function to the init-hook-list */
20 p->magic = CHASSIS_PLUGIN_MAGIC;
21- p->name = g_strdup("cli");
22- p->version = g_strdup("0.7.0");
23+ p->name = g_strdup("Proxy Client");
24+ p->version = g_strdup(PACKAGE_VERSION);
25
26 p->init = network_mysqld_cli_plugin_init;
27 p->get_options = network_mysqld_cli_plugin_get_options;
28
29=== modified file 'plugins/debug/debug-plugin.c'
30--- plugins/debug/debug-plugin.c 2010-09-02 12:56:11 +0000
31+++ plugins/debug/debug-plugin.c 2012-01-23 16:53:27 +0000
32@@ -429,7 +429,7 @@
33
34 G_MODULE_EXPORT int plugin_init(chassis_plugin *p) {
35 p->magic = CHASSIS_PLUGIN_MAGIC;
36- p->name = g_strdup("debug");
37+ p->name = g_strdup("Proxy Debug");
38 p->version = g_strdup(PACKAGE_VERSION);
39
40 p->init = network_mysqld_debug_plugin_new;
41
42=== modified file 'plugins/proxy/proxy-plugin.c'
43--- plugins/proxy/proxy-plugin.c 2011-09-21 18:48:19 +0000
44+++ plugins/proxy/proxy-plugin.c 2012-01-23 16:53:27 +0000
45@@ -2221,7 +2221,7 @@
46
47 G_MODULE_EXPORT int plugin_init(chassis_plugin *p) {
48 p->magic = CHASSIS_PLUGIN_MAGIC;
49- p->name = g_strdup("proxy");
50+ p->name = g_strdup("Proxy");
51 p->version = g_strdup(PACKAGE_VERSION);
52
53 p->init = network_mysqld_proxy_plugin_new;
54
55=== modified file 'plugins/replicant/replicant-plugin.c'
56--- plugins/replicant/replicant-plugin.c 2011-08-30 14:58:00 +0000
57+++ plugins/replicant/replicant-plugin.c 2012-01-23 16:53:27 +0000
58@@ -822,7 +822,7 @@
59
60 G_MODULE_EXPORT int plugin_init(chassis_plugin *p) {
61 p->magic = CHASSIS_PLUGIN_MAGIC;
62- p->name = g_strdup("replicant");
63+ p->name = g_strdup("Proxy Replicant");
64 p->version = g_strdup(PACKAGE_VERSION);
65 /* append the our init function to the init-hook-list */
66
67
68=== modified file 'src/chassis-frontend.c'
69--- src/chassis-frontend.c 2011-10-13 10:56:04 +0000
70+++ src/chassis-frontend.c 2012-01-23 16:53:27 +0000
71@@ -524,6 +524,20 @@
72 lua_close(L);
73 }
74
75+/**
76+ * log the versions of the initialized plugins
77+*/
78+int chassis_frontend_log_plugin_versions(GPtrArray *plugins) {
79+ guint i;
80+
81+ for (i = 0; i < plugins->len; i++) {
82+ chassis_plugin *p = plugins->pdata[i];
83+
84+ g_critical("%s %s started", p->name, p->version);
85+ }
86+
87+ return 0;
88+}
89
90 int chassis_frontend_write_pidfile(const char *pid_file, GError **gerr) {
91 int fd;
92
93=== modified file 'src/chassis-frontend.h'
94--- src/chassis-frontend.h 2010-07-07 07:57:26 +0000
95+++ src/chassis-frontend.h 2012-01-23 16:53:27 +0000
96@@ -151,6 +151,11 @@
97 CHASSIS_API void chassis_frontend_print_lua_version();
98
99 /**
100+ * log the versions of the initialized plugins
101+*/
102+CHASSIS_API int chassis_frontend_log_plugin_versions(GPtrArray *plugins);
103+
104+/**
105 * write the PID to a file
106 *
107 * @param pid_file name of the PID file
108
109=== modified file 'src/mysql-proxy-cli.c'
110--- src/mysql-proxy-cli.c 2011-09-08 09:13:48 +0000
111+++ src/mysql-proxy-cli.c 2012-01-23 16:53:27 +0000
112@@ -564,10 +564,10 @@
113 }
114 }
115
116- /* the message has to be _after_ the g_option_content_parse() to
117- * hide from the output if the --help is asked for
118+ /*
119+ * log the versions of all loaded plugins
120 */
121- g_message("%s started", PACKAGE_STRING); /* add tag to the logfile (after we opened the logfile) */
122+ chassis_frontend_log_plugin_versions(srv->modules);
123
124 #ifdef _WIN32
125 if (chassis_win32_is_service()) chassis_win32_service_set_state(SERVICE_RUNNING, 0);

Subscribers

People subscribed via source and target branches