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.
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).
With that infrastructure in place, it would then be possible to add
some more detailed logging in some places, like
- core: dump of complete headers from/to client
- proxy: dump of complete headers from/to backend
- ldap: trace communication to ldap server
What do you think of this idea? Would it be ok to drop the ability to
write the rewrite log into a separate file? Or should there also be
the possibility to configure a separate logfile per module?
Cheers,
Stefan