Welcome! Log In Create A New Profile

Advanced

Where is njs log file?

Posted by xmlredice 
Where is njs log file?
September 14, 2016 03:38AM
I write the sample nginxscript.
I wrote the line
req.log("hello from foo() handler");

But I can't find the log file, do you know the path of the log file or any document to guide to enable log message, thanks.

js_include http.js;
server {
location /hello {
js_set $foo foo;
add_header X-Foo $foo;
js_content baz;
}
}

https.js
function foo(req, res) {
req.log("hello from foo() handler");
return "foo";
}

function baz(req, res) {
res.headers.foo = 1234;
res.status = 200;
res.contentType = "text/plain; charset=utf-8";
res.contentLength = 15;
res.sendHeader();
res.send("nginx");
res.send("java");
res.send("script");

res.finish();
}
Re: Where is njs log file?
September 14, 2016 04:59AM
I found the solution to enable a debugging log by http://nginx.org/en/docs/debugging_log.html
./configure --with-debug
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 97
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 254 on July 05, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready