9951 explained code solutions for 126 technologies


nginx-luaHow to write to error log


server {
  location / {
    content_by_lua_block {
      ngx.log(ngx.ERR, "error text")
    }
  }
}ctrl + c
content_by_lua_block

nginx-lua module directive to specify block of Lua code

ngx.log

logs given message

ngx.ERR

we're going to write into error_log, you can also use other error levels

"error text"

message we want to log