Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks! I'm trying to debug a perl script on a hosting server but the erroras don't show up on the error log. The script seems to die while using a module I wrote but I can't be sure since, as I said, I can't read the errors. I tried a simple like "print STDERR 'something\n' " but it didn't show either.

So I tried to redirect STDERR to a file, and then to STDOUT (using *STDERR = \*STDOUT) but none worked.

Is there any other way to make the server admit he made a mistake? Can I somehow extract it from the server?

thanks.

  • Comment on [slightly OT] Getting errors and bypassing apache error log

Replies are listed 'Best First'.
Re: [slightly OT] Getting errors and bypassing apache error log
by Limbic~Region (Chancellor) on Mar 07, 2004 at 18:30 UTC
    Anonymous Monk,
    Assuming this is a CGI script: take a look at the carpout function in CGI::Carp which is designed specifically for this problem.

    Cheers - L~R

Re: [slightly OT] Getting errors and bypassing apache error log
by matija (Priest) on Mar 07, 2004 at 18:40 UTC
    Some solutions, in order of simplicity:
    • use CGI::Carp qw(fatalsToBrowser); will cause (most) fatal errors to appear in your browser window instead of in the error log.
    • carpout as mentioned above by Limbic~Region will redirect errors to another log.
    • If you can communicate to the hosting people, you might be able to persuade them to change the apache setting LogLevel to Warn or better. Then the errors should appear in regular error log.
      matija,
      I debated on mentioning fatalsToBrowser as well. The reason why I suggested carpout extends beyond redirecting errors to another readable log. It is suggested to be put inside a BEGIN block. This allows seeing compile time errors which would normally otherwise be inaccessible. It also allows you to see errors that happen when some other user is accessing it. It helps tracking down problems to have your very own web log when your provider doesn't give you access.

      I should have been complete however so thanks for filling in the blanks.

      Cheers - L~R

Re: [slightly OT] Getting errors and bypassing apache error log
by Vautrin (Hermit) on Mar 07, 2004 at 20:43 UTC
    You may want to check your web servers log files.

    Want to support the EFF and FSF by buying cool stuff? Click here.