You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Ruediger Pluem <rp...@apache.org> on 2010/06/09 19:39:59 UTC
Re: svn commit: r951893 - in /httpd/httpd/trunk: configure.in include/ap_mmn.h
include/http_config.h include/http_log.h include/httpd.h server/config.c
server/core.c server/log.c server/util_debug.c
On 06/06/2010 06:54 PM, sf@apache.org wrote:
> Author: sf
> Date: Sun Jun 6 16:54:51 2010
> New Revision: 951893
>
> URL: http://svn.apache.org/viewvc?rev=951893&view=rev
> Log:
> - Introduce log levels trace1/.../trace8
> - Add macro wrappers for ap_log_*error. On C99, this will save argument
> preparation and function call overhead when a message is not logged
> because of the configured loglevel.
> - Introduce per-module loglevel configuration.
>
> Modified:
> httpd/httpd/trunk/configure.in
> httpd/httpd/trunk/include/ap_mmn.h
> httpd/httpd/trunk/include/http_config.h
> httpd/httpd/trunk/include/http_log.h
> httpd/httpd/trunk/include/httpd.h
> httpd/httpd/trunk/server/config.c
> httpd/httpd/trunk/server/core.c
> httpd/httpd/trunk/server/log.c
> httpd/httpd/trunk/server/util_debug.c
>
> Modified: httpd/httpd/trunk/include/http_config.h
> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/http_config.h?rev=951893&r1=951892&r2=951893&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/include/http_config.h (original)
> +++ httpd/httpd/trunk/include/http_config.h Sun Jun 6 16:54:51 2010
> @@ -470,6 +482,44 @@ AP_DECLARE(void) ap_set_module_config(ap
>
>
> /**
> + * Generic accessor for modules to get the module-specific loglevel
> + * @param s The server from which to get the loglevel.
> + * @param index The module_index of the module to get the loglevel for.
> + * @return The module-specific loglevel
> + */
> +AP_DECLARE(int) ap_get_module_loglevel(const server_rec *s, int index);
> +
> +/**
> + * Accessor to set module-specific loglevel
> + * @param p A pool
> + * @param s The server for which to set the loglevel.
> + * @param index The module_index of the module to set the loglevel for.
> + * @param level The new log level
> + * @return The module-specific loglevel
> + */
> +AP_DECLARE(void) ap_set_module_loglevel(apr_pool_t *p, server_rec *s,
> + int index, int level);
Nitpick: Documentation and declaration do not match. This functions returns void.
> +
> +#if !defined(AP_DEBUG)
> +
> +#define ap_get_module_loglevel(s,i) \
> + (i < 0 || (s)->module_loglevels == NULL || (((s)->module_loglevels)[i]) < 0 ? \
> + (s)->loglevel : \
> + ((s)->module_loglevels)[i])
> +
> +#endif /* AP_DEBUG */
> +
> +/**
> + * Reset all module-specific loglevels to server default
> + * @param p A pool
> + * @param s The server for which to set the loglevel.
> + * @param index The module_index of the module to set the loglevel for.
> + * @param level The new log level
> + * @return The module-specific loglevel
Nitpick: Documentation and declaration do not match. This functions returns void.
> + */
> +AP_DECLARE(void) ap_reset_module_loglevels(server_rec *s);
> +
> +/**
> * Generic command handling function for strings
> * @param cmd The command parameters for this directive
> * @param struct_ptr pointer into a given type
>
> Modified: httpd/httpd/trunk/include/http_log.h
> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/http_log.h?rev=951893&r1=951892&r2=951893&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/include/http_log.h (original)
> +++ httpd/httpd/trunk/include/http_log.h Sun Jun 6 16:54:51 2010
> @@ -91,9 +109,79 @@ extern "C" {
> #define DEFAULT_LOGLEVEL APLOG_WARNING
> #endif
>
> +#define APLOG_NO_MODULE -1
> +
> +/*
> + * Objects with static storage duration are set to NULL if not
> + * initialized explicitly. This means if aplog_module_index
> + * is not initalized using the APLOG_USE_MODULE or the
> + * AP_DECLARE_MODULE macro, we can safely fall back to
> + * use APLOG_NO_MODULE.
> + */
> +static int * const aplog_module_index;
> +#define APLOG_MODULE_INDEX \
> + (aplog_module_index ? *aplog_module_index : APLOG_NO_MODULE)
> +
> +/*
> + * APLOG_MAX_LOGLEVEL can be used to remove logging above some
> + * specified level at compile time.
> + */
> +#ifndef APLOG_MAX_LOGLEVEL
> +#define APLOG_MODULE_IS_LEVEL(s,module_index,level) \
> + ( (((level)&APLOG_LEVELMASK) <= APLOG_NOTICE) || \
> + (s == NULL) || \
> + (ap_get_module_loglevel(s, module_index) \
> + >= ((level)&APLOG_LEVELMASK) ) )
> +#else
> +#define APLOG_MODULE_IS_LEVEL(s,module_index,level) \
> + ( (((level)&APLOG_LEVELMASK) <= APLOG_MAX_LOGLEVEL) && \
> + ( (((level)&APLOG_LEVELMASK) <= APLOG_NOTICE) || \
> + (s == NULL) || \
> + (ap_get_module_loglevel(s, module_index) \
> + >= ((level)&APLOG_LEVELMASK) ) ) )
> +#endif
> +
> +#define APLOG_IS_LEVEL(s,level) \
> + APLOG_MODULE_IS_LEVEL(s,APLOG_MODULE_INDEX,level)
> +
> +#define APLOGinfo(s) APLOG_IS_LEVEL(s,APLOG_INFO)
> +#define APLOGdebug(s) APLOG_IS_LEVEL(s,APLOG_DEBUG)
> +#define APLOGtrace1(s) APLOG_IS_LEVEL(s,APLOG_TRACE1)
> +#define APLOGtrace2(s) APLOG_IS_LEVEL(s,APLOG_TRACE2)
> +#define APLOGtrace3(s) APLOG_IS_LEVEL(s,APLOG_TRACE3)
> +#define APLOGtrace4(s) APLOG_IS_LEVEL(s,APLOG_TRACE4)
> +#define APLOGtrace5(s) APLOG_IS_LEVEL(s,APLOG_TRACE5)
> +#define APLOGtrace6(s) APLOG_IS_LEVEL(s,APLOG_TRACE6)
> +#define APLOGtrace7(s) APLOG_IS_LEVEL(s,APLOG_TRACE7)
> +#define APLOGtrace8(s) APLOG_IS_LEVEL(s,APLOG_TRACE8)
> +
> +#define APLOG_R_IS_LEVEL(r,level) APLOG_IS_LEVEL(r->server,level)
> +#define APLOGrinfo(r) APLOG_R_IS_LEVEL(r,APLOG_INFO)
> +#define APLOGrdebug(r) APLOG_R_IS_LEVEL(r,APLOG_DEBUG)
> +#define APLOGrtrace1(r) APLOG_R_IS_LEVEL(r,APLOG_TRACE1)
> +#define APLOGrtrace2(r) APLOG_R_IS_LEVEL(r,APLOG_TRACE2)
> +#define APLOGrtrace3(r) APLOG_R_IS_LEVEL(r,APLOG_TRACE3)
> +#define APLOGrtrace4(r) APLOG_R_IS_LEVEL(r,APLOG_TRACE4)
> +#define APLOGrtrace5(r) APLOG_R_IS_LEVEL(r,APLOG_TRACE5)
> +#define APLOGrtrace6(r) APLOG_R_IS_LEVEL(r,APLOG_TRACE6)
> +#define APLOGrtrace7(r) APLOG_R_IS_LEVEL(r,APLOG_TRACE7)
> +#define APLOGrtrace8(r) APLOG_R_IS_LEVEL(r,APLOG_TRACE8)
> +
> +#define APLOG_C_IS_LEVEL(c,level) APLOG_IS_LEVEL(c->base_server,level)
> +#define APLOGcinfo(c) APLOG_C_IS_LEVEL(c,APLOG_INFO)
> +#define APLOGcdebug(c) APLOG_C_IS_LEVEL(c,APLOG_DEBUG)
> +#define APLOGctrace1(r) APLOG_C_IS_LEVEL(c,APLOG_TRACE1)
> +#define APLOGctrace2(r) APLOG_C_IS_LEVEL(c,APLOG_TRACE2)
> +#define APLOGctrace3(r) APLOG_C_IS_LEVEL(c,APLOG_TRACE3)
> +#define APLOGctrace4(r) APLOG_C_IS_LEVEL(c,APLOG_TRACE4)
> +#define APLOGctrace5(r) APLOG_C_IS_LEVEL(c,APLOG_TRACE5)
> +#define APLOGctrace6(r) APLOG_C_IS_LEVEL(c,APLOG_TRACE6)
> +#define APLOGctrace7(r) APLOG_C_IS_LEVEL(c,APLOG_TRACE7)
> +#define APLOGctrace8(r) APLOG_C_IS_LEVEL(c,APLOG_TRACE8)
Why r on the left side and c on the right one?
I guess it should be
#define APLOGctrace1(c) APLOG_C_IS_LEVEL(c,APLOG_TRACE1)
instead for example.
> +
> extern int AP_DECLARE_DATA ap_default_loglevel;
>
> -#define APLOG_MARK __FILE__,__LINE__
> +#define APLOG_MARK __FILE__,__LINE__,APLOG_MODULE_INDEX
>
> /**
> * Set up for logging to stderr.
> @@ -164,10 +253,20 @@ void ap_logs_child_init(apr_pool_t *p, s
> * simple format string like "%s", followed by the string containing the
> * untrusted data.
> */
> -AP_DECLARE(void) ap_log_error(const char *file, int line, int level,
> - apr_status_t status, const server_rec *s,
> - const char *fmt, ...)
> - __attribute__((format(printf,6,7)));
> +#if __STDC_VERSION__ >= 199901L
> +/* need additional step to expand APLOG_MARK first */
> +#define ap_log_error(...) ap_log_error__(__VA_ARGS__)
> +#define ap_log_error__(file, line, mi, level, status, s, ...) \
> + do { server_rec *sr = s; if (APLOG_MODULE_IS_LEVEL(sr, mi, level)) \
> + ap_log_error_(file, line, mi, level, status, sr, __VA_ARGS__); \
> + } while(0)
Why can't we use s directly and need sr?
> +#else
> +#define ap_log_error ap_log_error_
> +#endif
> +AP_DECLARE(void) ap_log_error_(const char *file, int line, int module_index,
> + int level, apr_status_t status,
> + const server_rec *s, const char *fmt, ...)
> + __attribute__((format(printf,7,8)));
>
> /**
> * ap_log_perror() - log messages which are not related to a particular
> @@ -188,10 +288,20 @@ AP_DECLARE(void) ap_log_error(const char
> * simple format string like "%s", followed by the string containing the
> * untrusted data.
> */
> -AP_DECLARE(void) ap_log_perror(const char *file, int line, int level,
> - apr_status_t status, apr_pool_t *p,
> - const char *fmt, ...)
> - __attribute__((format(printf,6,7)));
> +#if __STDC_VERSION__ >= 199901L && defined(APLOG_MAX_LOGLEVEL)
> +/* need additional step to expand APLOG_MARK first */
> +#define ap_log_perror(...) ap_log_perror__(__VA_ARGS__)
> +#define ap_log_perror__(file, line, mi, level, status, p, ...) \
> + do { if ((level) <= APLOG_MAX_LOGLEVEL ) \
> + ap_do_log_perror(file, line, mi, level, status, p, \
> + __VA_ARGS__); } while(0)
Why ap_do_log_perror and not ap_log_perror_?
> +#else
> +#define ap_log_perror ap_log_perror_
> +#endif
> +AP_DECLARE(void) ap_log_perror_(const char *file, int line, int module_index,
> + int level, apr_status_t status, apr_pool_t *p,
> + const char *fmt, ...)
> + __attribute__((format(printf,7,8)));
>
> /**
> * ap_log_rerror() - log messages which are related to a particular
Regards
Rüdiger
Re: svn commit: r951893 - in /httpd/httpd/trunk: configure.in include/ap_mmn.h
include/http_config.h include/http_log.h include/httpd.h server/config.c
server/core.c server/log.c server/util_debug.c
Posted by Rainer Jung <ra...@kippdata.de>.
On 10.06.2010 08:09, Ruediger Pluem wrote:
>
>
> On 06/09/2010 10:00 PM, Stefan Fritsch wrote:
>> On Wed, 9 Jun 2010, Ruediger Pluem wrote:
>
>>>
>>> +#if __STDC_VERSION__>= 199901L&& defined(APLOG_MAX_LOGLEVEL)
>>> +/* need additional step to expand APLOG_MARK first */
>>> +#define ap_log_perror(...) ap_log_perror__(__VA_ARGS__)
>>> +#define ap_log_perror__(file, line, mi, level, status, p,
>>> ...) \
>>> + do { if ((level)<= APLOG_MAX_LOGLEVEL
>>> ) \
>>> + ap_do_log_perror(file, line, mi, level, status,
>>> p, \
>>> + __VA_ARGS__); } while(0)
>>> +#else
>>> +#define ap_log_perror ap_log_perror_
>>> +#endif
>>> +AP_DECLARE(void) ap_log_perror_(const char *file, int line, int
>>> module_index,
>>> + int level, apr_status_t status,
>>> apr_pool_t *p,
>>> + const char *fmt, ...)
>>> + __attribute__((format(printf,7,8)));
>>>
>>>
>>> I am still confused then.
>>> Why having AP_DECLARE(void) ap_log_perror_ then?
>>> Why define ap_log_perror to ap_log_perror_ on non C99 compilers then?
>>> ap_do_log_perror only shows up in the definition of ap_log_perror__
>>> nowhere else.
>>> What does it do?
>>
>> It allows (with C99 compilers) to remove debug/trace logging at compile
>> time by defining APLOG_MAX_LOGLEVEL. The other ap_log_*error functions
>> allow the same.
>>
>>
>
> Sorry for be a PITN, but if APLOG_MAX_LOGLEVEL is defined on a C99 environment
> this results is the following:
>
> config.c: In function 'ap_process_config_tree':
> config.c:1871: warning: implicit declaration of function 'ap_do_log_perror'
> log.c: In function 'ap_log_pid':
> log.c:892: warning: implicit declaration of function 'ap_do_log_perror'
> util.c: In function 'ap_get_local_host':
> util.c:2009: warning: implicit declaration of function 'ap_do_log_perror'
> listen.c: In function 'make_sock':
> listen.c:57: warning: implicit declaration of function 'ap_do_log_perror'
> core.c: In function 'set_document_root':
> core.c:1215: warning: implicit declaration of function 'ap_do_log_perror'
> mod_so.c: In function 'load_module':
> mod_so.c:186: warning: implicit declaration of function 'ap_do_log_perror'
> http_protocol.c: In function 'ap_method_register':
> http_protocol.c:500: warning: implicit declaration of function 'ap_do_log_perror'
> server/.libs/libmain.a(log.o): In function `ap_log_pid':
> /usr/src/apache/httpd-trunk/server/log.c:892: undefined reference to `ap_do_log_perror'
> server/.libs/libmain.a(listen.o): In function `alloc_listener':
> /usr/src/apache/httpd-trunk/server/listen.c:284: undefined reference to `ap_do_log_perror'
> /usr/src/apache/httpd-trunk/server/listen.c:322: undefined reference to `ap_do_log_perror'
> server/.libs/libmain.a(listen.o): In function `ap_apply_accept_filter':
> /usr/src/apache/httpd-trunk/server/listen.c:225: undefined reference to `ap_do_log_perror'
> server/.libs/libmain.a(listen.o): In function `make_sock':
> /usr/src/apache/httpd-trunk/server/listen.c:57: undefined reference to `ap_do_log_perror'
> server/.libs/libmain.a(listen.o):/usr/src/apache/httpd-trunk/server/listen.c:67: more undefined references to
> `ap_do_log_perror' follow
> collect2: ld returned 1 exit status
> make[1]: *** [httpd] Fehler 1
> make: *** [all-recursive] Fehler 1
Fixed and tested (r953248).
Rainer
Re: svn commit: r951893 - in /httpd/httpd/trunk: configure.in include/ap_mmn.h
include/http_config.h include/http_log.h include/httpd.h server/config.c
server/core.c server/log.c server/util_debug.c
Posted by Ruediger Pluem <rp...@apache.org>.
On 06/09/2010 10:00 PM, Stefan Fritsch wrote:
> On Wed, 9 Jun 2010, Ruediger Pluem wrote:
>>
>> +#if __STDC_VERSION__ >= 199901L && defined(APLOG_MAX_LOGLEVEL)
>> +/* need additional step to expand APLOG_MARK first */
>> +#define ap_log_perror(...) ap_log_perror__(__VA_ARGS__)
>> +#define ap_log_perror__(file, line, mi, level, status, p,
>> ...) \
>> + do { if ((level) <= APLOG_MAX_LOGLEVEL
>> ) \
>> + ap_do_log_perror(file, line, mi, level, status,
>> p, \
>> + __VA_ARGS__); } while(0)
>> +#else
>> +#define ap_log_perror ap_log_perror_
>> +#endif
>> +AP_DECLARE(void) ap_log_perror_(const char *file, int line, int
>> module_index,
>> + int level, apr_status_t status,
>> apr_pool_t *p,
>> + const char *fmt, ...)
>> + __attribute__((format(printf,7,8)));
>>
>>
>> I am still confused then.
>> Why having AP_DECLARE(void) ap_log_perror_ then?
>> Why define ap_log_perror to ap_log_perror_ on non C99 compilers then?
>> ap_do_log_perror only shows up in the definition of ap_log_perror__
>> nowhere else.
>> What does it do?
>
> It allows (with C99 compilers) to remove debug/trace logging at compile
> time by defining APLOG_MAX_LOGLEVEL. The other ap_log_*error functions
> allow the same.
>
>
Sorry for be a PITN, but if APLOG_MAX_LOGLEVEL is defined on a C99 environment
this results is the following:
config.c: In function 'ap_process_config_tree':
config.c:1871: warning: implicit declaration of function 'ap_do_log_perror'
log.c: In function 'ap_log_pid':
log.c:892: warning: implicit declaration of function 'ap_do_log_perror'
util.c: In function 'ap_get_local_host':
util.c:2009: warning: implicit declaration of function 'ap_do_log_perror'
listen.c: In function 'make_sock':
listen.c:57: warning: implicit declaration of function 'ap_do_log_perror'
core.c: In function 'set_document_root':
core.c:1215: warning: implicit declaration of function 'ap_do_log_perror'
mod_so.c: In function 'load_module':
mod_so.c:186: warning: implicit declaration of function 'ap_do_log_perror'
http_protocol.c: In function 'ap_method_register':
http_protocol.c:500: warning: implicit declaration of function 'ap_do_log_perror'
server/.libs/libmain.a(log.o): In function `ap_log_pid':
/usr/src/apache/httpd-trunk/server/log.c:892: undefined reference to `ap_do_log_perror'
server/.libs/libmain.a(listen.o): In function `alloc_listener':
/usr/src/apache/httpd-trunk/server/listen.c:284: undefined reference to `ap_do_log_perror'
/usr/src/apache/httpd-trunk/server/listen.c:322: undefined reference to `ap_do_log_perror'
server/.libs/libmain.a(listen.o): In function `ap_apply_accept_filter':
/usr/src/apache/httpd-trunk/server/listen.c:225: undefined reference to `ap_do_log_perror'
server/.libs/libmain.a(listen.o): In function `make_sock':
/usr/src/apache/httpd-trunk/server/listen.c:57: undefined reference to `ap_do_log_perror'
server/.libs/libmain.a(listen.o):/usr/src/apache/httpd-trunk/server/listen.c:67: more undefined references to
`ap_do_log_perror' follow
collect2: ld returned 1 exit status
make[1]: *** [httpd] Fehler 1
make: *** [all-recursive] Fehler 1
Regards
Rüdiger
Re: svn commit: r951893 - in /httpd/httpd/trunk: configure.in
include/ap_mmn.h include/http_config.h include/http_log.h include/httpd.h
server/config.c server/core.c server/log.c server/util_debug.c
Posted by Stefan Fritsch <sf...@sfritsch.de>.
On Wed, 9 Jun 2010, Ruediger Pluem wrote:
> On 06/09/2010 09:36 PM, Stefan Fritsch wrote:
>> On Wed, 9 Jun 2010, Ruediger Pluem wrote:
>>> On 06/06/2010 06:54 PM, sf@apache.org wrote:
>>>> Author: sf
>>>> Date: Sun Jun 6 16:54:51 2010
>>>> New Revision: 951893
>>>>
>>>> URL: http://svn.apache.org/viewvc?rev=951893&view=rev
>>>> Log:
>>>> - Introduce log levels trace1/.../trace8
>>>> - Add macro wrappers for ap_log_*error. On C99, this will save argument
>>>> preparation and function call overhead when a message is not logged
>>>> because of the configured loglevel.
>>>> - Introduce per-module loglevel configuration.
>>>>
>>
>>>> /**
>>>> * ap_log_perror() - log messages which are not related to a particular
>>>> @@ -188,10 +288,20 @@ AP_DECLARE(void) ap_log_error(const char
>>>> * simple format string like "%s", followed by the string containing
>>>> the
>>>> * untrusted data.
>>>> */
>>>> -AP_DECLARE(void) ap_log_perror(const char *file, int line, int level,
>>>> - apr_status_t status, apr_pool_t *p,
>>>> - const char *fmt, ...)
>>>> - __attribute__((format(printf,6,7)));
>>>> +#if __STDC_VERSION__ >= 199901L && defined(APLOG_MAX_LOGLEVEL)
>>>> +/* need additional step to expand APLOG_MARK first */
>>>> +#define ap_log_perror(...) ap_log_perror__(__VA_ARGS__)
>>>> +#define ap_log_perror__(file, line, mi, level, status, p,
>>>> ...) \
>>>> + do { if ((level) <= APLOG_MAX_LOGLEVEL
>>>> ) \
>>>> + ap_do_log_perror(file, line, mi, level, status,
>>>> p, \
>>>> + __VA_ARGS__); } while(0)
>>>
>>> Why ap_do_log_perror and not ap_log_perror_?
>>
>> There is no ap_log_perror_ because the pool p does not have a per-module
>> loglevel configuration.
>
> +#if __STDC_VERSION__ >= 199901L && defined(APLOG_MAX_LOGLEVEL)
> +/* need additional step to expand APLOG_MARK first */
> +#define ap_log_perror(...) ap_log_perror__(__VA_ARGS__)
> +#define ap_log_perror__(file, line, mi, level, status, p, ...) \
> + do { if ((level) <= APLOG_MAX_LOGLEVEL ) \
> + ap_do_log_perror(file, line, mi, level, status, p, \
> + __VA_ARGS__); } while(0)
> +#else
> +#define ap_log_perror ap_log_perror_
> +#endif
> +AP_DECLARE(void) ap_log_perror_(const char *file, int line, int module_index,
> + int level, apr_status_t status, apr_pool_t *p,
> + const char *fmt, ...)
> + __attribute__((format(printf,7,8)));
>
>
> I am still confused then.
> Why having AP_DECLARE(void) ap_log_perror_ then?
> Why define ap_log_perror to ap_log_perror_ on non C99 compilers then?
> ap_do_log_perror only shows up in the definition of ap_log_perror__ nowhere else.
> What does it do?
It allows (with C99 compilers) to remove debug/trace logging at compile
time by defining APLOG_MAX_LOGLEVEL. The other ap_log_*error functions
allow the same.
Re: svn commit: r951893 - in /httpd/httpd/trunk: configure.in include/ap_mmn.h
include/http_config.h include/http_log.h include/httpd.h server/config.c
server/core.c server/log.c server/util_debug.c
Posted by Ruediger Pluem <rp...@apache.org>.
On 06/09/2010 09:36 PM, Stefan Fritsch wrote:
> On Wed, 9 Jun 2010, Ruediger Pluem wrote:
>> On 06/06/2010 06:54 PM, sf@apache.org wrote:
>>> Author: sf
>>> Date: Sun Jun 6 16:54:51 2010
>>> New Revision: 951893
>>>
>>> URL: http://svn.apache.org/viewvc?rev=951893&view=rev
>>> Log:
>>> - Introduce log levels trace1/.../trace8
>>> - Add macro wrappers for ap_log_*error. On C99, this will save argument
>>> preparation and function call overhead when a message is not logged
>>> because of the configured loglevel.
>>> - Introduce per-module loglevel configuration.
>>>
>
>>> /**
>>> * ap_log_perror() - log messages which are not related to a particular
>>> @@ -188,10 +288,20 @@ AP_DECLARE(void) ap_log_error(const char
>>> * simple format string like "%s", followed by the string containing
>>> the
>>> * untrusted data.
>>> */
>>> -AP_DECLARE(void) ap_log_perror(const char *file, int line, int level,
>>> - apr_status_t status, apr_pool_t *p,
>>> - const char *fmt, ...)
>>> - __attribute__((format(printf,6,7)));
>>> +#if __STDC_VERSION__ >= 199901L && defined(APLOG_MAX_LOGLEVEL)
>>> +/* need additional step to expand APLOG_MARK first */
>>> +#define ap_log_perror(...) ap_log_perror__(__VA_ARGS__)
>>> +#define ap_log_perror__(file, line, mi, level, status, p,
>>> ...) \
>>> + do { if ((level) <= APLOG_MAX_LOGLEVEL
>>> ) \
>>> + ap_do_log_perror(file, line, mi, level, status,
>>> p, \
>>> + __VA_ARGS__); } while(0)
>>
>> Why ap_do_log_perror and not ap_log_perror_?
>
> There is no ap_log_perror_ because the pool p does not have a per-module
> loglevel configuration.
+#if __STDC_VERSION__ >= 199901L && defined(APLOG_MAX_LOGLEVEL)
+/* need additional step to expand APLOG_MARK first */
+#define ap_log_perror(...) ap_log_perror__(__VA_ARGS__)
+#define ap_log_perror__(file, line, mi, level, status, p, ...) \
+ do { if ((level) <= APLOG_MAX_LOGLEVEL ) \
+ ap_do_log_perror(file, line, mi, level, status, p, \
+ __VA_ARGS__); } while(0)
+#else
+#define ap_log_perror ap_log_perror_
+#endif
+AP_DECLARE(void) ap_log_perror_(const char *file, int line, int module_index,
+ int level, apr_status_t status, apr_pool_t *p,
+ const char *fmt, ...)
+ __attribute__((format(printf,7,8)));
I am still confused then.
Why having AP_DECLARE(void) ap_log_perror_ then?
Why define ap_log_perror to ap_log_perror_ on non C99 compilers then?
ap_do_log_perror only shows up in the definition of ap_log_perror__ nowhere else.
What does it do?
>
> All the other things you pointed out in this mail have been fixed in
> r953125.
Thanks.
Regards
Rüdiger
Re: svn commit: r951893 - in /httpd/httpd/trunk: configure.in
include/ap_mmn.h include/http_config.h include/http_log.h include/httpd.h
server/config.c server/core.c server/log.c server/util_debug.c
Posted by Stefan Fritsch <sf...@sfritsch.de>.
On Wed, 9 Jun 2010, Ruediger Pluem wrote:
> On 06/06/2010 06:54 PM, sf@apache.org wrote:
>> Author: sf
>> Date: Sun Jun 6 16:54:51 2010
>> New Revision: 951893
>>
>> URL: http://svn.apache.org/viewvc?rev=951893&view=rev
>> Log:
>> - Introduce log levels trace1/.../trace8
>> - Add macro wrappers for ap_log_*error. On C99, this will save argument
>> preparation and function call overhead when a message is not logged
>> because of the configured loglevel.
>> - Introduce per-module loglevel configuration.
>>
>> /**
>> * ap_log_perror() - log messages which are not related to a particular
>> @@ -188,10 +288,20 @@ AP_DECLARE(void) ap_log_error(const char
>> * simple format string like "%s", followed by the string containing the
>> * untrusted data.
>> */
>> -AP_DECLARE(void) ap_log_perror(const char *file, int line, int level,
>> - apr_status_t status, apr_pool_t *p,
>> - const char *fmt, ...)
>> - __attribute__((format(printf,6,7)));
>> +#if __STDC_VERSION__ >= 199901L && defined(APLOG_MAX_LOGLEVEL)
>> +/* need additional step to expand APLOG_MARK first */
>> +#define ap_log_perror(...) ap_log_perror__(__VA_ARGS__)
>> +#define ap_log_perror__(file, line, mi, level, status, p, ...) \
>> + do { if ((level) <= APLOG_MAX_LOGLEVEL ) \
>> + ap_do_log_perror(file, line, mi, level, status, p, \
>> + __VA_ARGS__); } while(0)
>
> Why ap_do_log_perror and not ap_log_perror_?
There is no ap_log_perror_ because the pool p does not have a per-module
loglevel configuration.
All the other things you pointed out in this mail have been fixed in
r953125.