Welcome! Log In Create A New Profile

Advanced

Log to a file inside a location block?

Thomas Nyberg
April 23, 2016 03:36PM
Hello,

Is there any way to log to a file which location block is taken? I've
had times when I've messed up regular expressions in location blocks and
it was difficult to track down the issue. Is there any option equivalent
to this pseudocode?

location ~ ^/prepend(a|b) {
logtofile "/prepend(a|b)" filepath;
# Continue normal stuff...
}

Of course logtofile could also be a "print" or really anything that gets
the information out somewhere.

My nginx version is the following:

$ nginx -v
nginx version: nginx/1.4.6 (Ubuntu)

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.2 LTS
Release: 14.04
Codename: trusty

Thanks for any help!

Cheers,
Thomas

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Log to a file inside a location block?

Thomas Nyberg April 23, 2016 03:36PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 218
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready