On 04.06.2010 23:57, Stefan Fritsch wrote:
On Friday 04 June 2010, Stefan Fritsch wrote:
which are either pure bug fixes or pretty trivial. I will create a
new  patch series without these soon, hopefully tomorrow.

The next iteration is at

http://people.apache.org/~sf/per-module-loglevel-v5/

It doesn't compile, two small problems, both in include/http_config.h:

1) ap_get_module_loglevel still contains (s)->loglevel and (s)->module_loglevels instead of s->log.level and s->log.module_levels. Trivial to fix.

2) The do-loops in the macros ap_get_conn_module_loglevel() and ap_get_request_module_loglevel() break when injected into an expression in server/log.c lines 584f.

I used nested function macros to fix 2), because that way the logic seemed to be readable best. At the end the macros for server, conn and request used a common macro, so I renamed ap_get_module_loglevel() to ap_get_server_module_loglevel() and used ap_get_module_loglevel() for the common part. Because of the rename, another three files have small changes. If you don't like the rename, your welcome to choose some other name for the new macro :)

Patch on top of your v5 at:

http://people.apache.org/~rjung/patches/httpd-trunk-per-module-loglevel-v5-addon-1.patch

During the build I also noticed, that mod_lua has two lines, where it doesn't use APLOG_MARK but instead directly passes two file/line args along. We need to fix those like you did for mod_ssl:

diff --git a/modules/lua/lua_config.c b/modules/lua/lua_config.c
index dd77cd8..f4d6e96 100644
--- a/modules/lua/lua_config.c
+++ b/modules/lua/lua_config.c
@@ -174,7 +174,10 @@ static int cmd_log_at(lua_State *L, int level)
     lua_getinfo(L, "Sl", &dbg);

     msg = luaL_checkstring(L, 2);
-    ap_log_error(dbg.source, dbg.currentline, level, 0, cmd->server, msg);
+/* Needs fixing for per-module-loglevel */
+#if 0
+ ap_log_error(dbg.source, dbg.currentline, level, 0, cmd->server, msg);
+#endif
     return 0;
 }

diff --git a/modules/lua/lua_request.c b/modules/lua/lua_request.c
index a18c74d..06609c6 100644
--- a/modules/lua/lua_request.c
+++ b/modules/lua/lua_request.c
@@ -407,7 +407,10 @@ static int req_log_at(lua_State *L, int level)
     lua_getinfo(L, "Sl", &dbg);

     msg = luaL_checkstring(L, 2);
+/* Needs fixing for per-module-loglevel */
+#if 0
     ap_log_rerror(dbg.source, dbg.currentline, level, 0, r, msg);
+#endif
     return 0;
 }

Since there has been some positive comments about the changes, I will
commit before the next alpha (my current plan is Sunday). But anyone
is of course welcome to review them before then.

With those changes the build runs successful and first tests look good (I can see new trace log entries and I can reconfigure loglevel with graceful restart). I agree you should go ahead. Congratulations, very useful!

Regards,

Rainer

Reply via email to