Debug

From Request Tracker Wiki
Jump to navigation Jump to search

Logs

See LogsConfig.

Apache

See also ApacheConfig

one process mode

This is useful only for debug, this start only one apache process and prevent concurent requests.

/usr/local/apache/bin/httpd -X

Perl debugger with Apache/Mod_perl

Install the module Apache::DB.

Put this in your apache config file:

<IfDefine PERLDB>
  <Perl>
    use Apache::DB ();
    Apache::DB->init();
  </Perl>
  <Location /rt>
    PerlFixupHandler Apache::DB
  </Location>
</IfDefine>

You may need to change the location to your own installation. Then stop the main apache server and start apache like this:

/usr/local/apache/bin/httpd -X -DPERLDB

Now, any http request you make to RT will drop you in the debugger first.

[http://search.cpan.org/dist/DBI DBI::ProfileDumper::Apache]

Maybe not everyone knows this but if you use mod_perl and RT(2/3) then you can use this in httpd.conf:

PerlSetEnv DBI_PROFILE DBI::ProfileDumper::Apache

At each stop/start of Apache you'll get profiling data in your logs directory which you can analyse with dbiprof. If a mod_perl/apache process terminaties due to max accesses reached it will also dump its profile data.

For more information see dbiprof -h.

NOTE: Apache doesn't need to be in one process mode.

[http://search.cpan.org/dist/Apache-DB Apache::DProf, Apache::SmallProf]

This is useful when you're going to profile perl code.

  • DProf dump profile per sub
  • SmallProf dump profile per line

In httpd.conf

<Perl>
        use Apache::DB ();
        Apache::DB->init;
 </Perl>
 # comment this line if you want SmallProf
 PerlModule Apache::DProf
 ...
 # previous block should be before other perl modules
 PerlRequire ...webmux.pl
 ...
 <Location ...>
        ...
        PerlHandler RT::Mason
        # In the same location or diretory block where
        # RT::Mason configured add fixup handler
        # if you want profile each line of perl code
        # uncomment next line
        # PerlFixupHandler Apache::SmallProf
 </Location>
 

NOTE: The server must be started with the -X to use Apache::DB

Other profilers

Email

get email content

You send email to RT and it fails and you think that exactly content in mail break RT. In this case you should get full MIME content of email.

  • Mozilla Mail variant
    • Send email that fails
    • Find it in Sent folder
    • Click on it
    • Ctrl-U
    • Now you should see "Source of:..." page
    • Copy content. It's exactly what you need.

This content can be used to check if your mailgate works fine:

  • open your alias files and copy RT alias
  • run alias as shell command, don't forget to add debug option.
cat |/opt/rt3/bin/rt-mailgate --queue ... --url ... --debug
  • now mailgate wait for email content on STDIN, paste content.
  • press Ctrl-D