[Catalyst] Simplest way to insert debug messages for Apache2 + Catalyst?

Brandon Black blblack at gmail.com
Thu Mar 9 00:04:29 CET 2006


On 3/8/06, Edric H <ehankamo at yahoo.com> wrote:
> Hello, I've recently started using Catalyst + Apache2 as the server and have
> had a big pain in debugging my code and checking if certain statements are
> reached. I've tried googling with little luck... so far what I've tried was:
>
>  sub end : Private {
>      my ( $self, $c ) = @_;
>
>  A:
>      $c->log->debug("SWORDFISH");
>  B:
>       $c->log->info("SWORDFISH2");
>  C:
>     open(foo,'>>mydirectory/file')
>     print foo 'SWORDFISH3';
>     close(foo);
>
>     if (!$c->res->redirect || !$c->res->output) {
>          $c->forward('WWW::Admon::V::TT');
>      }
>  }
>
>  A and B don't seem to output anything anywhere. Ideally i'd like the
> messages to print to my apache error log.
>
>  Method C has been my best bet and my counterparts who worked with Catalyst
> before me suggested this method to me... now i know there has to be a more
> elegant way of making debug messages...
>
>  Can anyone please tell me or point me in the right direction? I've googled
> for a long time... I've mainly found answers for when Catalyst is standalone
> without Apache. Hopefully this is not a stupid question. Thanks.
>

If Debug is turned on (use Catalyst qw/-Debug/ in your main app
class), $c->log->debug("xxx") should show up in your apache error log
(like /var/log/apache2/error_log, or wherever you have it configured
to be at), along with all the usual Catalyst startup and per-request
debugging info.

-- Brandon



More information about the Catalyst mailing list