Thanks Piotr, I'll have a look into that. I found another way to do what I was trying to do but this is useful info anyhow. Appreciate it!
> On 29 Oct 2019, at 20:08, Piotr Przybylski <pio...@gmail.com> wrote:
>
> There must be more going on in your configuration, this example works for me.
>
> Maybe you have some error_page definitions? They are separate locations that use internal redirects, so log phase happens in location that handles these documents, not in the location that is initially matched.
>
> W dniu poniedziałek, 28 października 2019 20:00:04 UTC+1 użytkownik Igor Clark napisał:
> Hello everyone,
>
> ]Even with the most basic example:
>
> location = /wtf {
> log_by_lua_block {
> ngx.log( ngx.ERR, "hello from log_by_lua_block" )
> }
> return 404;
> }
>
> nothing gets logged, same with 5xx, and also if I do it using ngx.status - but if I return 2xx it logs as you'd imagine.
>
> Is that the expected behaviour? Can't find anything in the docs, maybe it's just standard nginx phase stuff where you only get to log phase on a "successful" request?
>
> Thanks!
> Igo .