You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Vyacheslav Zholudev <vy...@gmail.com> on 2009/06/04 20:36:09 UTC

[users@httpd] Log output from fprintf(stdout, ...)

I have an Apache Module which contains such methods like 
fprintf(stderr, "%s\n", message); and fprintf(stdout, "%s\n", message);

They are executed under certain circumstances, but I can't see the output in
the Apache's log files.

I use directive ErrorLog and CustomLog ... combined with LogLevel debug, but
still can't see the result of my fprintfs. 
Does anybody have an idea what I might do wrong? 

Thanks in advance,
Vyacheslav
-- 
View this message in context: http://www.nabble.com/Log-output-from-fprintf%28stdout%2C-...%29-tp23875520p23875520.html
Sent from the Apache HTTP Server - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Log output from fprintf(stdout, ...)

Posted by Vyacheslav Zholudev <vy...@gmail.com>.
Thanks, Tom. It was helpful. However, I also use the part of code which
contains fprintfs in another context, so I really need those fprintfs. And
moreover I don't want to consider those messages as apache log messages. 

So the question remains, is it possible to log messages sent to stdout and
stderr?
The possible temporary solution is to run Apache in non-daemon mode and
redirect its output to a file.



Tom Evans-3 wrote:
> 
> On Thu, 2009-06-04 at 11:36 -0700, Vyacheslav Zholudev wrote:
>> I have an Apache Module which contains such methods like 
>> fprintf(stderr, "%s\n", message); and fprintf(stdout, "%s\n", message);
>> 
>> They are executed under certain circumstances, but I can't see the output
>> in
>> the Apache's log files.
>> 
>> I use directive ErrorLog and CustomLog ... combined with LogLevel debug,
>> but
>> still can't see the result of my fprintfs. 
>> Does anybody have an idea what I might do wrong? 
>> 
>> Thanks in advance,
>> Vyacheslav
> 
> Use ap_log_error() instead. eg
> 
> #include <http_log.h>
> 
> void ap_log_error(const char *file, int line, int level, const
> server_rec *s, const char* fmt, ...);
> 
> Typically, you would use macros for the first two arguments:
> 
> ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, cmd->s, "%s", message);
> 
> Cheers
> 
> Tom
> 
> 
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Log-output-from-fprintf%28stdout%2C-...%29-tp23875520p23893859.html
Sent from the Apache HTTP Server - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Log output from fprintf(stdout, ...)

Posted by Tom Evans <te...@googlemail.com>.
On Thu, 2009-06-04 at 11:36 -0700, Vyacheslav Zholudev wrote:
> I have an Apache Module which contains such methods like 
> fprintf(stderr, "%s\n", message); and fprintf(stdout, "%s\n", message);
> 
> They are executed under certain circumstances, but I can't see the output in
> the Apache's log files.
> 
> I use directive ErrorLog and CustomLog ... combined with LogLevel debug, but
> still can't see the result of my fprintfs. 
> Does anybody have an idea what I might do wrong? 
> 
> Thanks in advance,
> Vyacheslav

Use ap_log_error() instead. eg

#include <http_log.h>

void ap_log_error(const char *file, int line, int level, const
server_rec *s, const char* fmt, ...);

Typically, you would use macros for the first two arguments:

ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, cmd->s, "%s", message);

Cheers

Tom


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org