On Wed, 24 Oct 2001, Etienne Marcotte wrote:

> When running a script from a browser, is it possible to actually see the
> error messages?
>
> Each time there is one it states "Internal Server Error" and says the
> error is in the log. Is there anyway to show it on the page, not in the
> log.. if not, where is located/named that log file usually (I run
> Apache)?
>
> What I am doing now is when I get that error I print a content type at
> the beginning of my script and change the die for a print and the a
> single "die;" .  It works, but I'm sure there is a way to see the error
> directly on the page if the headers have not been sent yet, no?

Take a look at the CGI::Carp module.  It will, if you import the
fatalsToBrowser symbol, print helpful messages to the browser screen for
debugging (and into the server error log).  I don't recommend using this
on a production system, but just as a diagnostic tool on a development
site.  You should catch fatal exceptions and handle them in a sane fashion
so your user doesn't just get some garbled, incomprehensible error
message.

I also tail -f the error log file in a separate term windown while I am
working so I can see what errors are being generated.  I use mod_perl for
most things, and CGI::Carp has some problems when run under mod_perl, so I
don't always use it.  You will need to look in your Apache configuration
file to see where the error log is, but it's usually under the logs
directory of your server root.

CGI::Carp is available from CPAN.

-- Brett
                                          http://www.chapelperilous.net/
------------------------------------------------------------------------
I'm a Hollywood writer; so I put on a sports jacket and take off my brain.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to