in reply to Custom Apache ErrorLog Using mod_perl

CGI::Carp does something like this; I don't know how well it translates to mod_perl. But it might just work as is, and if not you can read the source for a starting point. (It's done using @SIG{qw(__DIE__ __WARN__)} handlers.)

Makeshifts last the longest.

  • Comment on Re: Custom Apache ErrorLog Using mod_perl

Replies are listed 'Best First'.
Re^2: Custom Apache ErrorLog Using mod_perl
by tadman (Prior) on Aug 28, 2002 at 21:59 UTC
    I'm thinking I can just spam the ErrorLog at the beginning of each request, and that with a piped error-log handler, I can re-format it back in to something sensible, stripping out "empty" errors.

    I'm using CGI::Carp of course, but the errors it cranks out are free-form, just like you'd expect.
      I don't quite follow.. does CGI::Carp prefix your errors with a nice identifier and timestamp, or not? If yes, what exactly is the problem?

      Makeshifts last the longest.

        It does, but there's no session information. For example, using this:
        [Fri Nov 17 21:40:43 1995] test.pl: I'm confused at test.pl line 3.
        Which 500 error entry in your TransferLog corresponds to it? I'm trying to tag them according to a contrived "transmission identifier" which is stashed in an Apache note using a custom Handler.

        These "transmission identifiers" are put into the Apache log by changing the LogFormat:
        LogFormat "%{TAG}n %h %{%s}t (etc)..."
        Which results in a log that looks like:
        2777C6E63D6D48F0 11.22.33.44 1030572273 ...
        What I'm trying to do is insert, some how, the 'TAG' note into the ErrorLog stream as well. This is so I have a way of binding the error to the failed request in a very reliable way.

        In actuality, I could care less about the timestamp. In fact, I would much rather it wasn't there. What I need is to put the 'TAG' in the output, something like this:
        2777C6E63D6D48F0: test.pl: I'm confused at test.pl line 3.