> On 29 Dec 2016, at 17:26, Vincent Veyron <vv.li...@wanadoo.fr> wrote: > > On Wed, 28 Dec 2016 22:24:56 +0100 > Ben RUBSON <ben.rub...@gmail.com> 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.
Yes you're right, but most or request related errors have this info : [Fri Dec 30 13:57:16 2016] [error] [client 1.2.3.4] client denied by server configuration: /var/www/robots.txt [Fri Dec 30 14:09:31 2016] [error] [client 1.2.3.4] script '/var/www/wp-login.php' not found or unable to stat [Fri Dec 30 14:36:03 2016] [error] [client 1.2.3.4] user bob not found: / [Fri Dec 30 14:36:25 2016] [error] [client 1.2.3.4] user alice: authentication failure for "/": Password Mismatch [Fri Dec 30 13:40:23 2016] [error] [client 1.2.3.4] File does not exist: /var/www/favicon.ico [Fri Dec 30 00:00:04 2016] [error] [client 1.2.3.4] client sent HTTP/1.1 request without hostname [Thu Dec 29 17:13:41 2016] [error] [client 1.2.3.4] Directory index forbidden [Wed Dec 28 09:43:59 2016] [error] [client 1.2.3.4] Invalid URI in request GET etc... > 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___ Thank you very much Vincent ! It works as expected : [Fri Dec 30 14:32:05.175064 2016] [perl:warn] [pid 48723] [client 127.0.0.1:33045] mymsg As there is no output example, I did not test more than the first proposed function : $r->log_error(@message); My mistake :) Thank you again Vincent ! Best regards, Ben