Use ngx_cycle to obtain log object in handler function.

Previously used r->connection->log was causing segfault in some
circumstances (in particular, in proxy_unfinished.t test).