DevHeads.net

Logging in apache

Hi Team,

How apache writes to access_log or error log. Whether it opens File
Descriptor(FD) for each request/connection to write in log file.

Thanks
Hemant

Comments

Re: Logging in apache

By Eric Covener at 04/18/2018 - 14:04

On Wed, Apr 18, 2018 at 2:33 PM, Hemant Chaudhary
<hemantdude. ... at gmail dot com> wrote:
Logs are opened by the parent process at startup and the file
descriptors are inherited by the children. The files are kept open to
and just written by each thread when needed.

Re: Logging in apache

By Hemant Chaudhary at 04/18/2018 - 14:18

Thanks Eric

It means thread are using lock so that one thread/process can write a time.
Right ?

Re: Logging in apache

By Eric Covener at 04/18/2018 - 14:29

On Wed, Apr 18, 2018 at 3:18 PM, Hemant Chaudhary
<hemantdude. ... at gmail dot com> wrote:

Re: Logging in apache

By Rainer M. Canavan at 04/19/2018 - 07:36

On Wed, Apr 18, 2018 at 9:29 PM, Eric Covener < ... at gmail dot com> wrote:
If I recall correctly, that's only true as long as the log lines are shorter
than PIPE_BUF (apparently 4096 on Linux). Very long log lines are
actually sometimes written interleaved by httpd.

rainer

Re: Logging in apache

By Eric Covener at 04/19/2018 - 07:42

On Thu, Apr 19, 2018 at 8:36 AM, Rainer Canavan
<rainer. ... at sevenval dot com> wrote:
Good point. There was a very recent patch to make that work better
with piped loggers.