I'm writing a custom Nginx module (in C++). I am able to add any message to Nginx' error log without any issues, like:
std::cerr << "some content";
I do not know how to add something to Nginx' access log. I tried functions like ngx_log_debug0 but without success:
ngx_log_debug0(NGX_LOG_INFO, log, 0, "some content");
I tried this in two contexts:
I have a postconfiguration function with
ngx_conf_t *cfas a parameter from where I takelogvariable used above (as a second parameter):cf->logI have a function which handles http requests as a command which has interface:
ngx_int_t my_function(ngx_http_request_t *r);from where also tried to uselogbut also without success:r->connection->log
Do I need to setup smth? Everything else works fine. Perhaps it is not possible to add custom messages to original access log?