mod_substitute debugging

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

mod_substitute debugging

Nick Gearls
I added some debugging features in mod_substitute, damned useful when
trying to troubleshoot things.
I'll propose a patch but I'd like your advise about when to log debug info:

I added the following info:
1. line to be parsed, type or search (regex/string), replace string
2. in case of matching, the new value

All logging of debugging info is in level TRACE8

Remark: the matching string/regex is compiled, so it's not available at
run-time.
I added this info in the subst_pattern_t struct - with a #ifdef _DEBUG
to not waste memory in release mode

My main question is: do I leave all logging in release mode (TRACE8
level) or do I also make this logging dependent on the compile flag?

Nick

Reply | Threaded
Open this post in threaded view
|

Re: mod_substitute debugging

Ruediger Pluem


On 05/24/2017 03:56 PM, Nick Gearls wrote:

> I added some debugging features in mod_substitute, damned useful when trying to troubleshoot things.
> I'll propose a patch but I'd like your advise about when to log debug info:
>
> I added the following info:
> 1. line to be parsed, type or search (regex/string), replace string
> 2. in case of matching, the new value
>
> All logging of debugging info is in level TRACE8
>
> Remark: the matching string/regex is compiled, so it's not available at run-time.
> I added this info in the subst_pattern_t struct - with a #ifdef _DEBUG to not waste memory in release mode
>
> My main question is: do I leave all logging in release mode (TRACE8 level) or do I also make this logging dependent on
> the compile flag?

Neither :-).

Have a look at the

APLOG_*_IS_LEVEL macros in http_log.h and wrap the code that creates effort accordingly.
If the effort is just a simple ap_log_?error line then you need to nothing if compiled with a c99 compiler. See the
ap_log_* macro magic in http_log.h

Regards

Rüdiger
Reply | Threaded
Open this post in threaded view
|

Re: mod_substitute debugging

Nick Gearls
Hi Ruediger,

I understood that.
My main question was "Which code do I include and release version and
which one do I keep only for a debug build?"
I have no problem to have everything included with a run-time check, I
was just wondering if someone will not complain that this adds too much
things.

I'll prepare a patch to have everything included at run-time, we'll see
the feedback.

Thanks for your time

On 24-05-2017 16:17, Ruediger Pluem wrote:

>
> On 05/24/2017 03:56 PM, Nick Gearls wrote:
>> I added some debugging features in mod_substitute, damned useful when trying to troubleshoot things.
>> I'll propose a patch but I'd like your advise about when to log debug info:
>>
>> I added the following info:
>> 1. line to be parsed, type or search (regex/string), replace string
>> 2. in case of matching, the new value
>>
>> All logging of debugging info is in level TRACE8
>>
>> Remark: the matching string/regex is compiled, so it's not available at run-time.
>> I added this info in the subst_pattern_t struct - with a #ifdef _DEBUG to not waste memory in release mode
>>
>> My main question is: do I leave all logging in release mode (TRACE8 level) or do I also make this logging dependent on
>> the compile flag?
> Neither :-).
>
> Have a look at the
>
> APLOG_*_IS_LEVEL macros in http_log.h and wrap the code that creates effort accordingly.
> If the effort is just a simple ap_log_?error line then you need to nothing if compiled with a c99 compiler. See the
> ap_log_* macro magic in http_log.h
>
> Regards
>
> Rüdiger
>

Reply | Threaded
Open this post in threaded view
|

Re: mod_substitute debugging

Nick Gearls
Patch uploaded: https://bz.apache.org/bugzilla/show_bug.cgi?id=61132

On 30-05-2017 09:00, Nick Gearls wrote:

> Hi Ruediger,
>
> I understood that.
> My main question was "Which code do I include and release version and
> which one do I keep only for a debug build?"
> I have no problem to have everything included with a run-time check, I
> was just wondering if someone will not complain that this adds too
> much things.
>
> I'll prepare a patch to have everything included at run-time, we'll
> see the feedback.
>
> Thanks for your time
>
> On 24-05-2017 16:17, Ruediger Pluem wrote:
>>
>> On 05/24/2017 03:56 PM, Nick Gearls wrote:
>>> I added some debugging features in mod_substitute, damned useful
>>> when trying to troubleshoot things.
>>> I'll propose a patch but I'd like your advise about when to log
>>> debug info:
>>>
>>> I added the following info:
>>> 1. line to be parsed, type or search (regex/string), replace string
>>> 2. in case of matching, the new value
>>>
>>> All logging of debugging info is in level TRACE8
>>>
>>> Remark: the matching string/regex is compiled, so it's not available
>>> at run-time.
>>> I added this info in the subst_pattern_t struct - with a #ifdef
>>> _DEBUG to not waste memory in release mode
>>>
>>> My main question is: do I leave all logging in release mode (TRACE8
>>> level) or do I also make this logging dependent on
>>> the compile flag?
>> Neither :-).
>>
>> Have a look at the
>>
>> APLOG_*_IS_LEVEL macros in http_log.h and wrap the code that creates
>> effort accordingly.
>> If the effort is just a simple ap_log_?error line then you need to
>> nothing if compiled with a c99 compiler. See the
>> ap_log_* macro magic in http_log.h
>>
>> Regards
>>
>> Rüdiger
>>
>
>