On Wed, Dec 23, 2009 at 4:14 AM, Stefan Fritsch <[email protected]> wrote: > Hi, > > when debugging problems, one needs detailed debug logging of the > involved functions. Unfortunately, some modules (especially mod_ssl) > log so much that switching to LogLevel debug in a production > environment is often impractical. Therefore I think it would be very > useful if one could set the loglevel per module.
+1 in concept, this is one of the most annoying parts of the logging subsystem today! An alternative implementation would be something along the lines of how reconnoiter does logging: <https://labs.omniti.com/trac/reconnoiter/browser/trunk/src/utils/noit_log.h> This would definitely be a larger rewrite in general for logging, but would be much more flexible in the long run, but I have grown fond of how reconoiter's logging subsystem has worked. Most modules would do this in their init function: dlog = ap_log_stream_find("mod_foo/debug") elog = ap_log_stream_find("mod_foo/error") Where dlog/elog are static globals for that file. If the logging system is disabled for that module, logging in the module is then done like this: apL(dlog, "foo is wrong: %d", bar); Our current system only has emerg, alert, crit, error, warn, notice, info, debug, but because they are not configurable per-module, they are difficult to use effectively, I think in general if we had per-module logging, we could easily get by with just critical, error, info, and debug. > Also, there is some need to have finer control over what is logged, as > demonstrated by modules with their own log configuration > (SSLLogLevelDebugDump, DumpIOLogLevel, RewriteLogLevel, ...). I would > introduce some new loglevels above "debug" (maybe trace1 to trace6 > corresponding to the rewrite log levels) and use these for the most > detailed messages. Together with the per module log level, one could > then remove the special per module config directives. > > What I want is the admin being abled to configure something like this: > > LogLevel info ldap=debug authnz_ldap=debug ssl=warn rewrite=trace4 > > For the implementation I thought of some loglevel vector similar to > the construct used by ap_get_module_config. There should then be a > ap_get_module_loglevel and the ap_log_*error functions would get the > module_index as additional parameter. To make things somewhat source > compatible, one could redefine APLOG_MARK to something like > __FILE__,__LINE__,GLOBAL, i.e. most modules could be compiled without > changes (but would then use the global log level). To add support to a > module, something like > > #define APLOG_MARK_LDAP __FILE__,__LINE__,ldap_module->module_index > > and a global search and replace would be enough for most modules (or > one could even redefine APLOG_MARK in the module source). hmm, I'm not sure I really like having to redefine APLOG_MARK in every file.. It would be nice if we could build the macro into the module declaration perhaps? Thanks, Paul
