[dev] http_request->connection->log, cycle->log and ending '\n'

Manlio Perillo manlio_perillo at libero.it
Mon Dec 17 00:08:10 MSK 2007

Igor Sysoev ha scritto:
> On Sun, Dec 16, 2007 at 09:21:02PM +0100, Manlio Perillo wrote:
>> I have noted a difference in the log output of 
>> http_request->connection->log and cycle->log and ending.
>> For the former, an ending new line character is ignored, so writing
>> "log line" and "log line\n" is equivalent (but extra '\n' are not ignored).
>> For the latter, the ending new line character is never ignored.
>> What's the cause of this?
>> I would like to ignore an ending new line character for cycle->log, too.
> There's no difference in ngx_log_error().
> Probably, http code clean ending spaces, CR, and LF before ngx_log_error().

Sorry, I'm wrong.

The log output is:
2007/12/16 22:01:15 [error] 2995#0: *1 log line
, client:, server: localhost, URL: "/", host: "localhost:1234"

So the new line character *is* printed, but there is the extra text 
printed by the log handler that confused me.

Thanks  Manlio Perillo

More information about the nginx mailing list