On Wed, 28 Dec 2016 22:24:56 +0100
Ben RUBSON <[email protected]> wrote:
> I'm using the following to log error messages from mod_perl to Apache log
> files :
> $r->log_error("mymsg");
>
> It produces the following :
> [Sat Dec 24 09:39:43.933388 2016] [:error] [pid 8015] mymsg
>
> I'm a little bit suprised that it does not produce the following :
> [Sat Dec 24 09:39:43.933388 2016] [:error] [pid 8015] [client 1.2.3.4:32133]
> mymsg
>
> Why don't we have the [client] part with the client IP, as for every Apache
> error message ?
>
Not every Apache error message has that; for instance ssl errors in my logs
don't have it either :
[Tue Dec 27 20:14:25.730665 2016] [ssl:error] [pid 3243] AH02033: No hostname
was provided via SNI for a name based virtual host
you can use :
$r->log_rerror(Apache2::Log::LOG_MARK(), Apache2::Const::LOG_WARNING,
APR::Const::ENOTIME, "mymsg");
which outputs :
[Thu Dec 29 17:11:27.040549 2016] [perl:warn] [pid 7811] (20007)No time was
provided and one was required.: [client 127.0.0.1:58886] mymsg, referer:
http://ppro.libremen.com/
See :
https://perl.apache.org/docs/2.0/api/Apache2/Log.html#C____r_E_gt_log_rerror___
(note : there appears to be a typo in the example, missing parentheses after
LOG_MARK)
--
Bien à vous, Vincent Veyron
https://marica.fr/
Gestion des sinistres assurances, des dossiers contentieux et des contrats pour
le service juridique