Return-Path: X-Original-To: apmail-httpd-modules-dev-archive@minotaur.apache.org Delivered-To: apmail-httpd-modules-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DEDBB9FBE for ; Sun, 1 Jul 2012 19:54:14 +0000 (UTC) Received: (qmail 55253 invoked by uid 500); 1 Jul 2012 19:54:14 -0000 Delivered-To: apmail-httpd-modules-dev-archive@httpd.apache.org Received: (qmail 55196 invoked by uid 500); 1 Jul 2012 19:54:14 -0000 Mailing-List: contact modules-dev-help@httpd.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: modules-dev@httpd.apache.org Delivered-To: mailing list modules-dev@httpd.apache.org Received: (qmail 55183 invoked by uid 99); 1 Jul 2012 19:54:14 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 01 Jul 2012 19:54:14 +0000 X-ASF-Spam-Status: No, hits=3.4 required=5.0 tests=FH_FAKE_RCVD_LINE_B,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of ohaya@cox.net designates 68.230.241.216 as permitted sender) Received: from [68.230.241.216] (HELO eastrmfepo201.cox.net) (68.230.241.216) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 01 Jul 2012 19:54:07 +0000 Received: from eastrmimpo209.cox.net ([68.230.241.224]) by eastrmfepo201.cox.net (InterMail vM.8.01.04.00 201-2260-137-20101110) with ESMTP id <20120701195346.DVWS5450.eastrmfepo201.cox.net@eastrmimpo209.cox.net>; Sun, 1 Jul 2012 15:53:46 -0400 Received: from eastrmwml108 ([172.18.18.217]) by eastrmimpo209.cox.net with bizsmtp id V7tm1j0094h0NJL027tm5y; Sun, 01 Jul 2012 15:53:46 -0400 X-CT-Class: Clean X-CT-Score: 0.00 X-CT-RefID: str=0001.0A020202.4FF0AACA.0045,ss=1,re=0.000,fgs=0 X-CT-Spam: 0 X-Authority-Analysis: v=1.1 cv=Cw82oOEFC+LakX47VvMo3aQgTccLAUx+JQTseRfoPBA= c=1 sm=1 a=Wxf_Ra9a0DgA:10 a=G8Uczd0VNMoA:10 a=1N-yuG7BIooA:10 a=IkcTkHD0fZMA:10 a=PWBp/uTxiyyf5eZWroZrKg==:17 a=EWzUM3bjAAAA:8 a=kviXuzpPAAAA:8 a=z8wAMB67AAAA:8 a=M-b9rGSOcr18qtZgWEAA:9 a=QEXdDO2ut3YA:10 a=duB4itmD0tsA:10 a=4vB-4DCPJfMA:10 a=HJQdrg_q-uEA:10 a=PWBp/uTxiyyf5eZWroZrKg==:117 X-CM-Score: 0.00 Authentication-Results: cox.net; none Received: from 72.205.21.52 by webmail.east.cox.net; Sun, 1 Jul 2012 15:53:46 -0400 Message-ID: <20120701155346.0E76S.331189.imail@eastrmwml108> Date: Sun, 1 Jul 2012 15:53:46 -0400 From: To: modules-dev@httpd.apache.org Subject: Re: "Best practices" or recommendations for logging from a module? Cc: Joe Lewis In-Reply-To: <4FF0A5F2.8030907@joe-lewis.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) Sensitivity: Normal X-Virus-Checked: Checked by ClamAV on apache.org ---- Joe Lewis wrote: > On 07/01/2012 12:55 PM, ohaya@cox.net wrote: > > ---- ohaya@cox.net wrote: > > > >> ---- ohaya@cox.net wrote: > >> > >>> ---- Joe Lewis wrote: > >>> > >>>> Jim, you could use the log_error funtion all the time. Log_perror javits > >>>> logging associated with a pool, and log_rerror is for requests. If > >>>> possible, use log_rerror, because it puts the up address, etc into the logs. > >>>> > >>>> Joe > >>>> On Jul 1, 2012 10:56 AM, wrote: > >>>> > >>>> > >>> > >>> Joe, > >>> > >>> Thanks! > >>> > >>> Jim > >>> > >> > >> Hi, > >> > >> Oh, oh :(. > >> > >> I'm using: > >> > >> ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, NULL,); > >> > >> all over the place, and even though I have only one LogLevel in the httpd;conf, at the top level, set to "debug", I don't see those messages. > >> > >> The only ones I see are the ones that use APLOG_NOTICE. > >> > >> Why is this? I thought that with LogLevel set to debug, that I should see all level msgs output using ap_log_error? > >> > >> Thanks, > >> Jim > >> > >> > > > > Hi, > > > > I think that I've found out why I'm not seeing those log messages. Apparently, if the server parameter is NULL, only APLOG_NOTICE message appear except for during startup. > > > > So, I have use a server for that parameter, e.g. r->server, BUT, in some cases, e.g., in a function like the response callback for libcurl, where the signature is pre-defined, and where there is no request_rec or server_rec among the parameters, how can I get ap_log_error to output anything (other than APLOG_NOTICE) messages? > > > > Thanks, > > Jim > > > Again, if you have access to a request_rec structure, I'd use > ap_log_rerror. Otherwise, use ap_log_perror. Those have a better > consistency with logging, e.g. : > > ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, requestrec, "uri = %s",r->uri); > ap_log_perror(APLOG_MARK, APLOG_DEBUG, 0, pool, "creating config"); > > Joe Hi, I think that I'm not explaining the problem that I have very clearly :(... Per earlier thread, I'm using libcurl to make an HTTP GET request from my module. In order that my module can access the response to that GET request, I had to use a write callback function tha allows curl to t make the response available to my code. The signature for that function is: size_t static write_callback_func(void *buffer, size_t size, size_t nmemb, void *userp) Curl doesn't "know" anything about the Apache structures like the server, pool, etc. and from that signature, there isn't a way to for my code to pass any of that through to the call back function, and since I can't do that, there doesn't seem to be a way that I can get any of the ap_log_xxx() functions to actually output anything to the Apache error log. Hopefully, that's clearer explanation of the problem? Jim