[Dancer-users] How to debug Dancer?

woosley. xu. redicaps at gmail.com
Sun Sep 26 07:34:36 CEST 2010


 thanks a lot.
I should have read the cookbook carefully.

2010/9/26 Naveed Massjouni <naveedm9 at gmail.com>

> On Sun, Sep 26, 2010 at 1:13 AM, woosley. xu. <redicaps at gmail.com> wrote:
> > Right, maybe I am wrong about the debug info, I get the allo too.
> >
> >
> > what about code like this:
> >
> >   get '/' => sub {
> >        debug 'allo';
> >        die "run time error in code";
> >        return 'bye';
> >    };
> >    dance;
> >
> > I am expecting I can find the string "run time error in code"
> somewhere(log
> > or console), so I can locate what's wrong with my code exactly.
> > I am using Dancer 1.1810
> >
> > Thanks
>
> You should set show_errors to 1:
>
>    use Dancer;
>    set logger => 'file';
>    set log => 'core';
>     set show_errors => 1;
>    get '/' => sub {
>        die 'oops';
>        return 'bye';
>    };
>    dance;
>
> Run it and hit localhost:3000 with your browser.  You should see a
> nice stack trace.
>
> -Naveed
>
> >
> >
> > 2010/9/26 Naveed Massjouni <naveedm9 at gmail.com>
> >>
> >> On Sat, Sep 25, 2010 at 10:17 PM, woosley. xu. <redicaps at gmail.com>
> wrote:
> >> > Hi all,
> >> >        I just begin to use Dancer to build some small sites. It is
> >> > convenient for sure. But, my problem is, how can I debug a site when I
> >> > met
> >> > problems?
> >> >        I start with the code just  a PL file, no packages, all the
> >> > request
> >> > and function in one file. If there is any Perl grammar errors,  sure
> >> > Perl
> >> > can find them for me, but if there is any other run time errors,
> dancer
> >> > just
> >> > give me a Error 500, and there is nothing in the log file.
> >> >        Here is the log configuration in my code, I tried to use debug
> >> > "Hey,
> >> > I got here!", however,  this line never shows up in the log file,
> maybe
> >> > it
> >> > never execute? I have no idea.
> >> >
> >> >             set logger   => 'file';
> >> >             set log      => 'core';
> >> >       the common thing I have in the log is
> >> >
> >> >             [10141]  core @0.020718> [hit #1] response: 500 in
> >> > /opt/csw/share/perl/site_perl/Dancer/Handler.pm l. 102
> >> >
> >> >        How can I get all the error information?
> >> > Thanks
> >> > --
> >> > Woosley.Xu
> >>
> >> So I created a simple dancer application in a single file:
> >>
> >>    use Dancer;
> >>    set logger => 'file';
> >>    set log => 'core';
> >>    get '/' => sub {
> >>        debug 'allo';
> >>        return 'bye';
> >>    };
> >>    dance;
> >>
> >> Then I ran:
> >>
> >>    curl localhost:3000
> >>
> >> When I viewed logs/development.log, I saw the expected debug message.
> >>
> >> Maybe it would help if you provided some code that can reproduces the
> >> problem you are experiencing.  And tell us exactly which version of
> >> Dancer you are running.
> >>
> >> Thanks,
> >> Naveed
> >> _______________________________________________
> >> Dancer-users mailing list
> >> Dancer-users at perldancer.org
> >> http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
> >
> >
> >
> > --
> > Woosley.Xu
> >
> >
> >
> >
> > _______________________________________________
> > Dancer-users mailing list
> > Dancer-users at perldancer.org
> > http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
> >
> >
> _______________________________________________
> Dancer-users mailing list
> Dancer-users at perldancer.org
> http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
>



-- 
Woosley.Xu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.backup-manager.org/pipermail/dancer-users/attachments/20100926/e623e387/attachment-0001.htm>


More information about the Dancer-users mailing list