Http_request->connection->log, cycle->log and ending '\n'

Hi.

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.

Thanks Manlio P.

On Sun, Dec 16, 2007 at 09:21:02PM +0100, Manlio P. 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().

Igor S. ha scritto:

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: 127.0.0.1, 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 P.