Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Generating more readable errors with mod_perl

by nysus (Parson)
on Nov 25, 2017 at 12:43 UTC ( [id://1204231]=perlquestion: print w/replies, xml ) Need Help??

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

By default, error messages generated by mod_perl get dumped into the apache log file. Unfortunately, the log files show the literal \n character for new lines instead of an actual line break. This makes reading lengthy error messages difficult, resulting in lost time and aggravation.

How and where can I output the error messages so new lines will appear properly?

$PM = "Perl Monk's";
$MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate Priest";
$nysus = $PM . ' ' . $MCF;
Click here if you love Perl Monks

Replies are listed 'Best First'.
Re: Generating more readable errors with mod_perl
by Discipulus (Canon) on Nov 25, 2017 at 13:13 UTC
    Hello nysus,

    I'm not the best mod_perl nor Apache expert here around but I suspect this is not a mod_perl issue but an Apache one:

    > Starting from 2.0.49, the Apache logging API escapes everything that goes to error_log..

    CFLAGS="-DAP_UNSAFE_ERROR_LOG_UNESCAPED" ./configure seems to be the related configuration, but must be enabled at build time.. ;=(

    It's supposed to be a security issue: you must investigate it further. See here

    L*

    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

      I was wondering if there was a way to redirect errors to something other than the apache log file. That way I wouldn't be limited to the apache log file constraints.

      $PM = "Perl Monk's";
      $MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate Priest";
      $nysus = $PM . ' ' . $MCF;
      Click here if you love Perl Monks

        I think there is: see Log4perl faqs

        L*

        There are no rules, there are no thumbs..
        Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
Re: Generating more readable errors with mod_perl
by ww (Archbishop) on Nov 25, 2017 at 13:45 UTC

    I don't use mod_perl (and don't know much about it, but which one are you using?) but suspect you can trap the errors using eval; that's a supposition supported by this:

    https://perl.apache.org/docs/2.0/user/porting/compat.html

    "In mod_perl 2.0, <Perl> sections errors are now always fatal. Any error in them will cause an immediate server startup abort, dumping the error to STDERR. To avoid this, eval {} can be used to trap errors and ignore them. In mod_perl 1.0, strict was somewhat of a misnomer." (direct from big-G)

    FWIW, trapping with an eval does NOT appear to be exclusively mod_perl 2; SO has this; unsurprisingly, so does PM.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1204231]
Approved by johngg
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2024-04-26 04:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found