Here is a quick heads up on the extended Apache::TestTrace functionality:

1) you can now use Apache::TestTrace tracing functions in the mod_perl handlers, replacing those "warn" calls that you have to remember to comment out before committing. The default tracing level is 'info', so if you use:

    debug "this is a debug string"

it won't log anything,  unless you override it via one of these ways:

    # override tracing level via -trace opt
    % t/TEST -trace=debug

    # override tracing level via env var
    % env APACHE_TEST_TRACE_LEVEL=debug t/TEST

The cool thing is that you can keep those calls uncommented, and if a user reports a problem, you can simply ask them to run the specific tests using the 'debug' trace level (see above) and post the relevant section of error_log.

You also don't need to add "\n";

This wasn't working before because the tracing level wasn't propogated to the server-side. Now I added 'PerlPassEnv APACHE_TEST_TRACE_LEVEL' to the autogenerated t/conf/httpd.conf to pick the override.

2) I've added two more "macros" for each of those tracing functions:

If the '_mark' suffix is appended (e.g., 'error_mark') the trace will start with the filename and the line number the function was called from. For example:

   error_mark "bad programmer, no cookie";

Will print something like:

==> /home/stas/apache.org/mp-filters/t/filter/TestFilter/both_str_req_mix.pm:90 
:
bad programmer, no cookie

This is similar to calling warn() without the "\n", so it logs the filename/line number, but you can control the tracing level from the command line, without touching the code.

I've used _mark, in parallel with Apache::LOG_MARK.

If the '_sub' suffix is appended (e.g., 'error_info') the trace will start
with the name of the subroutine the function was called from. For example:

   error_sub "bad programmer, no cookie";

Will print something like:

==> TestFilter::both_str_req_mix::adjust : bad programmer, no cookie

Now that I think about it, may be it's better to append the sub name, file/line info at the end of the trace like warn/die do, instead of the beginning? What do you think?

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com



Reply via email to